Created
January 13, 2015 05:19
-
-
Save theVDude/493da7e468f8301204ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name TagPro Honk | |
// @description Honk by pressing up and down at the same time. | |
// @version 0.1 | |
// @grant none | |
// @require https://gist.githubusercontent.com/Holcomb227/867ffe3703013aed8945/raw/20f3ec84f3c2bd5333093a5f8a21c3f54b126045/howler.js | |
// @include http://tagpro-*.koalabeast.com:* | |
// @include http://tangent.jukejuice.com:* | |
// @include http://*.newcompte.fr:* | |
// @license 2015 | |
// @author CFlakes | |
// @namespace http://www.reddit.com/user/Cumflakes | |
// ==/UserScript== | |
tagpro.ready(function waitForId() { | |
if (!tagpro.playerId) return setTimeout(waitForId, 100); | |
var self = tagpro.players[tagpro.playerId], | |
honkSound = new Howl({ | |
urls: ["data:audio/mp3;base64,/4T0LVLSU1k69gAADSAAAAEbUZssTvHtyAAANIaAAAS45rVjIQU2fgwBJIre2H4M5tnzVSfbJmE0Y7W8Zc+exGI3+dJqJ8djznfzN8we+7Xl410zS1XH7t6Yp84vquqS/fg3p941rO8Uh+HfVKd7vTy9MVrvWby5pIAZbjcj76DJCANY4FZDCFsLYzDI0FH4oXGdC7sBQEA3iQAC+BkuSmNTmC/DtvIlqITwmLoO1BMBixELBO4N2IAFX8dtz9A49uXSu1QZ81c/l3/3I9f+nrgDXoJ18kDNlAM0q5kCo930VEDfI72Krtp/udS35kvHWPQ0bkyofXyzLLTXpVZzDBhC5SfWD3JgkaqE3e6t77lRm87S/GUdU+NaLpdiVsfrKroqI062rTfmsoAAAAFW6lcYTnBhYfp9nhJpj4a/jOjNCAHZYBMDfxlUQ4lEBGEBsDCREGHII/3jaVIS1BrC6GKc5lEnUMQBhowi9eOCIESafi1OZKul9poW4bpabtNV1lfyxfzeGW2jsyzvNij96yNEEkIK5NbPyOQ+ZM8d//uSZP+G9tBmy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01LKoBBoUOOqczItDAoCXSl6YxIplYCjoGBUtTACgaGlCOcWDhAw0FNCxy0bDHBggi6xoGjViJQ8rMhRbiMiS+Sghi1XfBj81NRvU3Y5foe5XOfUhvv46lj/ve+UDO9WELYYCOw7x1AJjrbkXAuxjuCJQ6Lfy6i/h0+sOv/7kmT/hPVdVs0Tm2tyAAANIAAAARWNiz2t6W3IAAA0gAAABBN1A0478njopKxlj7plD3Rrcy2vj+hg3V4fnMulSKHSdVRE8LFm2QKPTNBc3I2KhBctW5QukQkpqWscORjxSwFfJBVjIGVTgLDseFCw0oXAgE2AcLDCwgwy2a1E4wiaaAiEw+3vIbUdAI82tBK6cZCXVl+NyPt9qeef5zD+4dz7v/j2954N2m4PuEy668epqwk82p8i1X6yBG6ryQfUWi69ZqS/yeR/yDOumESwy+iC2TqV5vmlmCUGsXJySxbPS9sxqOib1/z09/SzXovqIZzTj1JPhkNtJ9HRqYgpqKZlxybkBQxMrowlNVVVVVVVVVVVVVVVVVVVVVVVVVUAAL1NxBOcGEA2xQTaSfMOhtvW+MjFUz2CzAYgNkg9EYGphw5COg7xGLmg0qnL8IsSpDQ4SAgFXRY7tdmG1McGB4RvxV7xEKpxtN5LW4wJcbvIs41VlGUc79f+V2u4bx9/mctSZBJHxjtoFSvEMbnj+1mTQblvY7AHtJmo7gkoZOb/+5Jk"], | |
sprite: { | |
mid: [20, 100] | |
} | |
}), | |
honkSprite = new PIXI.Sprite(PIXI.Texture.fromImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpi/P//PwMKaGBkwAoa/mOVY2LAD0Dy/WhiHEDcTYwBnEC8CogL0Fz2B4j9gdgInwEiQLwXiIPRxHmhBqyCGsLAgsPPx4BYFU0sBIgdgDgHiE8BcSrEAAhADklGLJpB4CEQW0HZN4FYnZhARAb3gVgOyn4OxBKkGvABiAWg7E/Q8CDJAHTwi1QDBKCuAAE+IP5MqgGKQPwIypYE4nfIBjAiYRC4g8UAeWj0MkBj4CZYI468AEpIm4HYAskCEOAB4i9A3AyN+jpcXngDxE5AvA5N/As07YQD8QZCYfAdiMOAeCI8N0IAyICNQHyOmED8C89MCPADiEthHIAAAwBEhjK+0yzwDgAAAABJRU5ErkJggg==")); | |
function getPlayers() { | |
for (var id in tagpro.players) { | |
if (!tagpro.players.hasOwnProperty(id)) continue; | |
var player = tagpro.players[id]; | |
if (player.up && player.down && player.draw && !player.dead) { | |
if (!player.isHonking) { | |
var startTime = Date.now(); | |
player.isHonking = true; | |
drawHonk(player); | |
honk(player, startTime); | |
} | |
} else { | |
if (player.isHonking) { | |
player.isHonking = false; | |
drawHonk(player, true); | |
} | |
} | |
} | |
requestAnimationFrame(getPlayers); | |
} | |
requestAnimationFrame(getPlayers); | |
function honk(player, startTime) { | |
if (!tagpro.sound) return; | |
if (player.isHonking && Date.now() - startTime < 4000) { | |
var distance = Math.sqrt(Math.pow(player.x - self.x, 2) + Math.pow(player.y - self.y, 2)), | |
volume = distance === 0 ? 1 : Math.max(1 - distance / 600, 0.1); | |
honkSound.volume(volume); | |
honkSound.play('mid'); | |
setTimeout(function () { | |
honk(player, startTime); | |
}, 80); | |
} else { | |
if (player.sprites.honk) drawHonk(player, true); | |
} | |
} | |
function drawHonk(player, remove) { | |
if (!player.sprites.honk && !remove) { | |
player.sprites.honk = honkSprite; | |
player.sprites.honk.x = 12; | |
player.sprites.honk.y = 12; | |
player.sprites.ball.addChild(player.sprites.honk); | |
} else { | |
if (player.sprites.honk && remove) { | |
player.sprites.ball.removeChild(player.sprites.honk); | |
player.sprites.honk = null; | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment