Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Pre-Match Map Preview V2
- // @namespace http://www.reddit.com/user/happytagpro/
- // @include http://tagpro-*.koalabeast.com:*
- // @include http://tangent.jukejuice.com:*
- // @include http://maptest.newcompte.fr:*
- // @author happy
- // @version 2
- // ==/UserScript==
- extraTime = 1 //increase this if you want more time between when the view zooms in and when the game starts. measured in seconds
- zoom = 2.5 //initial zoom level
- killPlayers = false
- tagpro.socket.on('time',function(message){
- time = message.time/1000
- if (message.state == 3) {
- killPlayers = true
- //store power up tiles and balls
- jukeJuice = tagpro.tiles[6.1]
- rollingBomb = tagpro.tiles[6.2]
- tagPro = tagpro.tiles[6.3]
- //replace power up tiles with generic ones, I used the fourth, unused power-up tile as my 'generic' tile, replace ball tiles with blank space tiles.
- var generic = tagpro.tiles[6.4]
- tagpro.tiles[6.1] = generic
- tagpro.tiles[6.2] = generic
- tagpro.tiles[6.3] = generic
- tagpro.api.redrawBackground()
- //zoom out, center map
- tagpro.spectator = true
- tagpro.zoom = zoom
- centerView()
- //when zoomed in, put back power ups and players
- delay = time-extraTime
- setTimeout(function(){
- tagpro.viewPort.followPlayer = true
- tagpro.zoom = 1
- tagpro.spectator = false
- tagpro.settings.ui.spectatorInfo = true
- killPlayers = false
- tagpro.tiles[6.1] = jukeJuice
- tagpro.tiles[6.2] = rollingBomb
- tagpro.tiles[6.3] = tagPro
- for (id in tagpro.players) {
- tagpro.players[id].dead = false
- }
- tagpro.api.redrawBackground()
- },delay*1000)
- }
- })
- //kill oppoent players (so that you can't see their positions when zoomed out)
- tagpro.socket.on('p',function(m){
- if (killPlayers) {
- if (!!m[0]) {
- if (!!tagpro.playerId) {
- for (id in tagpro.players) {
- if (tagpro.players[id].team != tagpro.players[tagpro.playerId].team) {
- tagpro.players[id].dead = true
- }
- }
- }
- }
- }
- })
- //hide spectator message
- tagpro.settings.ui.spectatorInfo = false
- //hide 'game starting soon...' alert so that you can see the map
- setTimeout(function(){
- original = tagpro.ui.largeAlert
- tagpro.ui.largeAlert = function (e,t,n,r,i){
- if (r == "Match Begins Soon...") {
- r=''
- }
- return original(e,t,n,r,i)
- }
- },400)
- //press 'c' to center the viewPort, I've put a delay on this because otherwise the keypress wouldn't register. code taken from spec bot
- function centerView() {
- setTimeout(function(){
- var press = $.Event('keydown');
- press.which = '67';
- $("#viewPort").trigger(press);
- press = $.Event('keyup');
- $("#viewPort").trigger(press);
- },50)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement