Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- topmouse="*Souris"
- round=0
- places=0
- players={}
- seedmod=4
- bombPower=20
- bombRadius=100
- bombClock=1000
- mineBoom=5
- mineClock=3000
- arrowSpeed=40
- pickupCount=3
- uiBackground=0x000000
- uiBorder=0xFFFFFF
- uiAlpha=0.8
- imgToken={
- "P9tQW0r.png",
- "EG4lG5p.png",
- "MTtMREM.png",
- "wwkx2qp.png",
- "uZd3sZA.png",
- "YklOFSC.png",
- "M29setX.png"
- }
- map={
- code=0,
- tokens={},
- name="Unknown",
- author=topmouse
- }
- standardKeys={
- 40, --DOWN
- 83, --DOWN
- 37, --LEFT
- 81, --LEFT
- 39, --RIGHT
- 68 --RIGHT
- }
- defaultKeys={
- pickup=69,
- airjump=75,
- bomb=76
- }
- defaultPlayer={
- airjumps=0,
- arrows=0,
- bombs=0,
- dashL=0,
- dashR=0,
- rocketjump=math.huge
- }
- admins={
- "Fxie",
- "Thewav",
- "Begentle",
- "Shamousey"
- }
- maps={
- "@4139085",
- "@4152173",
- "@4174846",
- "@4181712",
- --"@4202354", --http://pastebin.com/6agBEqYJ
- "@4243103",
- "@4258010",
- "@4263120",
- "@4276338",
- "@4276585",
- "@4276587",
- "@4281169"
- }
- text={
- _inventory="%s airjumps | %s arrows | %s bombs",
- _inventoryAdv="%s warps | %s pocketbombs | %s mines",
- author="Fxie",
- greet="Welcome to the %s for reckless racing.",
- greetSub="Compete in a PVP race to the finish line! Type %s to learn the controls.",
- greetTest="This is a testing room for derby maps. To load a derby map, type %s",
- roomRandom="This room only plays randomly generated derby maps!",
- roomAdvanced="You are in %shard mode%s. To play in standard mode, toggle shaman hard mode.",
- mgmtJoin="Manager %s just connected.",
- help="Making it in derby",
- helpDash="Double-tap left or right to dash (requires airjump)",
- helpRocketjump="Duck to charge up a rocketjump, then blast off!",
- helpArrows="Click to shoot arrows/pocketbombs!",
- helpAirjump="Press %s to use an airjump/warp!",
- helpBombs="Press %s to drop bombs/mines!",
- helpPickup="Press %s on a token to pick it up!",
- helpControl="Adjusting the keys",
- helpControlInstruct="Click the key to change it",
- helpControlAirjump="Use Airjump",
- helpControlBomb="Use Bombs",
- helpCredits="Making derby possible",
- helpCreditsCoding="Coded by %s",
- helpCreditsTranslation="%s translation by %s",
- tutorialPickup="Press %s on this to pick it up!",
- tutorialUse="You got %s! Press %s to use one!",
- newRace="Race to the finish line!",
- wonRace="%s won the race!",
- wonRound="%s won the round with %d points!",
- respawn="Respawning in %d seconds...",
- pickup="Picked up %s!",
- keySet="Press any key for %s...",
- look={
- _1_9="Hey there foxy lady -.^",
- _2_4="What a schick tophat, Moe!",
- _2_10="You're looking pretty artsy *-*",
- _4_1="That's a freakin' cute bow you're wearing :3",
- _5_2="Hey there farmer!"
- }
- }
- --[[text.BR={
- author="Maxxzinnn",
- greet="Bem-vindo a %s para uma corrida ousada.",
- greetSub="Compita em uma corrida PVP até a linha de chegada! Pressione %s para aprender os controles.",
- mgmtJoin="Administrador %s acabou de se conectar.",
- help="Aprendendo a jogar derby",
- helpDash="Aperte duas vezes para a esquerda ou direita para se impulsionar para frente (é necessário ter o pulo aéreo)",
- helpRocketjump="Abaixe por pelo menos 1 segundo para poder ser lançado para cima (segure por mais tempo para voar mais alto), então solte! Você irá ser lançado para cima.",
- helpAirjump="Pressione %s para ativar o segundo pulo no ar (Se disponível)",
- helpArrows="Pressione %s para atirar setas para trás e %s para atirar para frente",
- helpBombs="Pressione %s para lançar uma bomba",
- helpPickup="Pressione %s em um token de poder para pega-lo",
- helpEtc="Confira também... ",
- helpTokens="Tokens de poder",
- helpTokensGeneral="Existem 3 tipos de tokens de poder: Pulo aéreo, seta, e tokens bomba.",
- helpTokensHave="Você pode pegar os tokens de poder pressionando %s neles, mas você só pode pegar cada token de poder uma vez por vida (é restaurado para o normal quando você morre ou quando começa um novo jogo)",
- helpControl="Ajustando as teclas",
- helpControlSet="Digite %s para alterar os controles",
- helpControlGet="Digite %s para ter suas configuações, e %s para carrega-los (mais rápido do que altera-los de novo)",
- helpControlReset="Digite %s para restaurar os controles para o padrão (eles restauram a cada vez que você sai da sala)",
- newRace="Corra até a linha de chegada!",
- wonRace="%s venceu a corrida!",
- wonRound="%s venceu a partida com %d pontos!",
- respawn="Revivendo em %d segundos...",
- pickup="Você coletou %s!",
- pickupAdd="Agora você tem %s.",
- pickupHave="Você já tem este!",
- keySet="Pressione uma tecla por %s...",
- keySetInvalid="Copie os dados do %s para alterar os controles da sua configuração atual!",
- keySuccess="Controles configurados!",
- keyReset="Mudando controles para o padrão"
- }
- text.ES={
- author="Bogkitty",
- greet="Bienvenido al %s.",
- greetSub="¡Compite en una carrera PVP hasta la línea de meta! Escribe %s para aprender los controles.",
- mgmtJoin="El mánager %s se ha conectado.",
- help="Cómo jugar derby",
- helpDash="Presiona dos veces izquiera o derecha para impulsarte (requiere salto en el aire)",
- helpRocketjump="¡Salta como un cohete agachándote durante al menos 1 segundo (más tiempo para mayor poder), luego liberalo! Serás tirado hacia abajo y rebotarás en el suelo.",
- helpAirjump="Presiona %s para activar un segundo salto en el aire (si está disponible)",
- helpArrows="Presiona %s para disparar flechas detrás de ti y %s para disparar delante",
- helpBombs="Presiona %s para poner bombas",
- helpPickup="Presiona %s en una ficha de power-up para obtenerla",
- helpEtc="También echa un vistazo... ",
- helpTokens="Fichas de power-ups",
- helpTokensGeneral="Hay 3 tipos de fantásticas fichas de power-up en derby: salto en el aire, flechas y fichas de bomba.",
- helpTokensHave="Puedes recoger las fichas presionando %s sobre ellas, sin embargo, sólo puedes recoger una ficha por vida (se reinicia cuando mueres o un nuevo juego comienza)",
- helpControl="Ajustando las flechas",
- helpControlSet="Escribe %s para cambiar los controles",
- helpControlGet="Escribe %s para acceder a tu ajuste de teclado, y %s para cargarlos (más rápido que ajustándolos otra vez)",
- helpControlReset="Escribe %s para reiniciar los controles a su predeterminado (también se reinician cada vez que dejas la sala)",
- newRace="¡Compite hasta la línea de meta!",
- wonRace="%s ganó la carrera!",
- wonRound="%s ganó la ronda con %d puntos!",
- respawn="Reviviendo en %d segundos...",
- pickup="¡Has recogido %s!",
- pickupAdd="Ahora tienes %s.",
- pickupHave="¡Ya tienes eso!",
- keySet="Presiona una tecla para %s...",
- keySetInvalid="¡Copia los datos de %s para establecer la configuración de tus teclas actual!",
- keySuccess="¡Teclado establecido!",
- keyReset="Configuración de las teclas reiniciada al predeterminado",
- look={
- _1_9="¿Qué tal, señorita? -.^",
- _2_4="¡Qué sombrero de copa tan elegante, Moe!",
- _2_10="Te ves muy artístico *-*",
- _4_1="Es un lazo muy bonito el que llevas puesto :3",
- _5_2="¡Hola granjero!"
- }
- }
- text.FR={
- author="Thewav",
- greet="Bienvenue au salon %s pour faire des courses dégantées.",
- greetTest="Ceci est un salon de test pour le mini-jeu derby. Pour charger une map pour le mini-jeu, tape %s",
- greetSub="Élimine t'es adversaires pour finir premier! Pour connaitre les touches tape %s .",
- mgmtJoin="Le manager %s vient de se connecter.",
- help="Ce qui en fait une course folle",
- helpDash="Appuie deux fois sur la flèche de gauche ou de droite pour avoir un bonus de vitesse (utilise 1 airjump)",
- helpRocketjump="Accroupie toi puis releve toi pour faire un RocketJump",
- helpAirjump="Appuie sur %s pour pouvoir sauter une deuxième fois pendant que tu es dans les airs (utilise 1 airjump)",
- helpArrows="Appuie sur %s pour envoyer des flèches derrière toi ou %s pour en envoyer devant",
- helpBombs="Appuie sur %s faire exploser une bombe",
- helpPickup="Appuie sur %s pour prendre un jeton bonus",
- helpEtc="Pour en savoir plus... ",
- helpTokens="Les jetons bonus",
- helpTokensGeneral="Il y a trois type de jeton bonus: airjump, flèche (arrow), et bombe (bomb).",
- helpTokensHave="Tu peux prendre un jeton bonus en appuyant sur %s quand tu es dessus, tu peus prendre un jetons bonus qu'une seul fois par vie.",
- helpControl="Assignation des touches",
- helpControlSet="Appuie sur %s pour changer les touches par défaut",
- helpControlGet="Appuie sur %s pour connaitre les touches assignées, et %s pour les chargées.",
- helpControlReset="Appuie sur %s pour revenir au paramètres par défaut (Ils sont aussi remis par défaut quand tu quittes le salon.)",
- newRace="Cours jusqu'à la ligne d'arrivée",
- wonRace="%s a gagné la course!",
- wonRound="%s a gagné la partie avec %d points!",
- respawn="Résurrection dans %d secondes...",
- pickup="Tu as ramassé %s!",
- pickupAdd="Tu as maintenant %s.",
- pickupHave="Tu as déjà pris ceci!",
- keySet="Appuie sur la touche %s pour ...",
- keySetInvalid="Coppie %s to set keys from your current settings!",
- keySuccess="Touches assignées!",
- keyReset="Paramètres remis par defaut "
- }
- text.NL={
- author="Jordynl, Faranys",
- greet="Welkom in de %s voor roekeloos racen.",
- greetSub="Doe mee in een PVP race tot aan de finish! Typ %s om de bediening te leren.",
- greetTest="Dit is een testkamer voor derby maps. Om een derbymap te laden, type %s",
- mgmtJoin="Manager %s heeft zonet verbonden.",
- help="Hoe het werkt in Derby",
- helpDash="Druk dubbel op links of rechts om te vliegen (vereist luchtsprong)",
- helpRocketjump="Raketspring door ingeduwt te houden, dan los te laten!",
- helpAirjump="Druk op %s om een tweede sprong in de lucht te activeren (indien beschikbaar)",
- helpArrows="Druk op %s om pijlen achter je te schieten en op %s om vooruit te schieten",
- helpBombs="Druk op %s om bommen te platsen",
- helpPickup="Druk op %s op een power-up teken om het te krijgen",
- helpEtc="Bekijk ook... ",
- helpTokens="Power-up Tekens",
- helpTokensGeneral="Er zijn 3 types awesome power-up tekens te vinden in derby: luchtsprong, pijl, en bom tekens.",
- helpTokensHave="Je kan tekens oprapen door op %s te klikken op ze, je kan echter maar één teken oprapen per leven (reset wanneer je sterft of een nieuw spel begint)",
- helpControl="De toetsen veranderen",
- helpControlSet="Typ %s om de bediening te veranderen",
- helpControlGet="Typ %s om je toetseninstelling te krijgen, en %s om ze te laden (sneller dan ze opnieuw in te stellen)",
- helpControlReset="Typ %s om de bediening te resetten naar hun origineel (ze resetten ook als je de kamer verlaat)",
- helpCredits="Maak derby mogelijk",
- helpCreditsCoding="Geprogrammeerd door %s",
- helpCreditsTranslation="%s vertaling door %s",
- newRace="Race naar de finish!",
- wonRace="%s heeft de race gewonnen!",
- wonRound="%s heeft de ronde gewonnen met %d punten!",
- respawn="Herspawnen in %d seconden...",
- pickup="%s opgeraapt!",
- pickupAdd="Je hebt nu %s.",
- pickupHave="Je hebt dat al!",
- keySet="Druk een toets om %s...",
- keySetInvalid="Kopieer de data %s om de toetsen in te stellen van je huidige instelling!",
- keySuccess="Toetseninstelling!",
- keyReset="Toetseninstelling terug naar origineel",
- getKeys="Toetseninstelling: %s",
- getMaps="Maps (%d totaal): %s",
- look={
- _1_9="Hey daar sexy dame -.^",
- _2_4="What a schick tophat, Moe!",
- _2_10="Jij ziet er kunstig uit *-*",
- _4_1="Das een serieus schattige boog dat je draagt :3",
- _5_2="Hey daar boer!"
- }
- }
- text.TR={
- author="Ediz",
- greet="%s'ye, pervasız yarışa hoşgeldiniz.",
- greetSub="PVP yarışında bitiş çizgisine kadar yarışın! Kontrolleri öğrenmek için %s yazın",
- mgmtJoin="Menajer %s giriş yaptı.",
- help="Derby'i oynamak",
- helpDash= "Hızlanmak için sola ya da sağa basın (havada zıplama jetonu gerektirir)",
- helpRocketjump="Roket zıplama için eğilme tuşuna basılı tutun, sonra bırakın!",
- helpAirjump="İkinci zıplamayı aktif etmek için %s tuşuna basın (jetonunuz varsa)",
- helpArrows="Arkanıza ok fırlatmak için %s, önünüze fırlatmak için %s tuşuna basın",
- helpBombs="Bomba koymak için %s tuşuna basın",
- helpPickup="Bir özellik almak için bir jetonun üstüne gelip %s tuşuna basın",
- helpEtc="Aynı zamanda bunlara bakın...",
- helpTokens="Özel Güç Jetonları",
- helpTokensGeneral="3 farklı özel güç jetonları vardır: havada zıplama, ok ve bomba jetonları.",
- helpTokensHave="Bir jetonun üstünde durduğunuzda o jetonu %s tuşuyla alabilirsiniz, fakat her jeton her yaşam için bir kere alınabilir.(öldüğünüz zaman ya da yeni oyun başladığı zaman yeniden alabilirsiniz)",
- helpControl="Tuşları ayarlamak",
- helpControlSet="Kontrolleri değiştirmek için %s yazın.",
- helpControlGet="Şu anki kontrollerinizi öğrenmek için %s, açmak için %s yazın. (Kontrolleri tekrar yazmaktan daha hızlı)",
- helpControlReset="Kontrolleri orjinal haline getirmek için %s yazın. (Ayrıca odadan çıktığınız her zaman orjinal haline döner)",
- tutorialPickup="Bunu almak için %s tuşuna basın!",
- tutorialUse="%s aldınız! Bir tane kullanmak için %s tuşuna basın!",
- newRace="Bitiş çizgisine yarışın!",
- wonRace="%s yarışı kazandı!",
- wonRound="%s turu %d puanla kazandı!",
- respawn="%d saniye içinde yeniden doğacaksınız...",
- pickup="%s aldınız!",
- pickupAdd="Artık %s sahipsiniz.",
- pickupHave="Zaten bunu aldınız!",
- keySet="%s için bir tuşa basın...",
- keySetInvalid="%s 'daki veriyi kopyalayıp şu anki ayarlara ekleyin!",
- keySuccess="Tuşlar kaydedildi!",
- keyReset="Tuşlar orjinal hallerine döndürüldü"
- }]]--
- --Lua fundamentals
- function table.random(table)
- return table[math.random(#table)]
- end
- --I can't believe they still don't have this
- function ui.addTAStyle(id, text, player, x, y, width, height)
- local filler=width and height and "" or text
- ui.addTextArea(id+2, filler, player, x, y, width, height, 0x6a8fa2, 0x6a8fa2, 1, true)
- ui.addTextArea(id+1, filler, player, x, y+2, width, height, 0x000001, 0x000001, 1, true)
- ui.addTextArea(id, text, player, x, y+1, width, height, 0x324650, 0x324650, 1, true)
- end
- function ui.removeTAStyle(id, player)
- ui.removeTextArea(id+2, player)
- ui.removeTextArea(id+1, player)
- ui.removeTextArea(id, player)
- end
- --Sign my ass
- function isAdmin(name)
- for i=1, #admins do
- if admins[i]==name then
- return true
- end
- end
- end
- --Set dem mice
- function setPlayer(name)
- for prop, value in pairs(defaultPlayer) do
- players[name][prop]=value
- end
- updateInv(name)
- end
- --Set dem tuts
- function setTutorial(name)
- local tutToken={x=math.huge}
- local player=players[name]
- for i, token in ipairs(map.tokens) do
- if token.x<tutToken.x and not player.tokens[i] then
- tutToken=token
- end
- end
- if tutToken.type then
- player.tutorial=tutToken
- ui.addTextArea(-1, text.tutorialPickup:format("<J>E<N>"), name, math.max(tutToken.x-100, 20), tutToken.y>100 and tutToken.y-60 or tutToken.y+40, 200, nil, uiBackground, uiBorder, uiAlpha)
- end
- end
- --Set dem keys
- function setKeys(name, keys)
- local player=players[name]
- for control, key in pairs(player.keys) do
- tfm.exec.bindKeyboard(name, key, true, false)
- end
- for control, key in pairs(keys) do
- player.keys[control]=key
- tfm.exec.bindKeyboard(name, key, true, true)
- end
- for i, key in ipairs(standardKeys) do
- tfm.exec.bindKeyboard(name, key, true, true)
- end
- for i, key in ipairs({40, 83}) do
- tfm.exec.bindKeyboard(name, key, false, true)
- end
- end
- --Mice accessories
- function getLook(name)
- local look=tfm.get.room.playerList[name].look
- local items={look:match("%d+")}
- for item in look:match(";(.+)"):gmatch("[^, ]+") do
- table.insert(items, tonumber(item:match("%d+")) or 0)
- end
- return items
- end
- --Token "art"
- function drawToken(id, name, got)
- local token=map.tokens[id]
- if token then
- if players[name].tokenImgs[id] then
- tfm.exec.removeImage(players[name].tokenImgs[id])
- end
- if got==true then
- players[name].tokenImgs[id]=tfm.exec.addImage(imgToken[7], "_50", token.x-18, token.y-18, name)
- --ui.addTextArea(id*2, " ", name, token.x-10, token.y-10, 20, 20, 0x080808, 0x000000, 0.25)
- elseif players[name].advanced then
- players[name].tokenImgs[id]=tfm.exec.addImage(imgToken[token.type+3], "_50", token.x-18, token.y-18, name)
- --[[
- ui.addTextArea(id*2, "<font size='30'><b>"..({"w", "*", "."})[token.type].."</b></font>", name, token.x-15, token.y-15, 30, 30, 0x000000, 0xFFFFFF, 0.5)
- if got~=false then
- ui.addTextArea(id*2+1, ({"Warp", "Pocketbomb", "Mine"})[token.type], name, token.x-20, token.y-35, nil, nil, nil, nil, 0)
- end
- --]]--
- else
- players[name].tokenImgs[id]=tfm.exec.addImage(imgToken[token.type], "_50", token.x-18, token.y-18, name)
- --[[
- ui.addTextArea(id*2, "<font size='30'><b>"..({"^", "=", "O"})[token.type].."</b></font>", name, token.x-15, token.y-15, 30, 30, 0x000000, 0xFFFFFF, 0.5)
- if got~=false then
- ui.addTextArea(id*2+1, ({"Airjump", "Arrow", "Bomb"})[token.type], name, token.x-20, token.y-35, nil, nil, nil, nil, 0)
- end
- --]]--
- end
- end
- end
- --Inventory check
- function updateInv(name)
- local player=players[name]
- local text=(player.advanced and text._inventoryAdv or text._inventory):format(
- "<J><b>"..player.airjumps.."</b><N>",
- "<J><b>"..player.arrows.."</b><N>",
- "<J><b>"..player.bombs.."</b><N>")
- ui.updateTextArea(232, text, name)
- ui.updateTextArea(231, text, name)
- ui.updateTextArea(230, text, name)
- end
- --Experimental P0 maps
- function generateMap(seed)
- seed=tonumber(seed) or os.time()
- map.seed=seed
- math.randomseed(seed)
- local setSpawn, setCheese, setHole=false, false, false
- local ground, gfloat
- local gprev={X=0, Y=0, H=400, L=0}
- local grounds, micestuff, objects={}, {}, {}
- function XML(tag, object)
- tag="<"..tag.." "
- for prop, val in pairs(object) do
- tag=tag..prop..'="'..val..'" '
- end
- return tag.."/>"
- end
- function makeGround(ground)
- table.insert(grounds, XML("S", ground))
- if ground.T==6 and ground.L>40 then
- table.insert(micestuff, XML("P", {
- P=math.random()<0.5 and "0, 0" or "0, 1",
- X=ground.X+math.random(30-ground.L/2, ground.L/2-30),
- Y=ground.Y-ground.H/2,
- T=table.random({0, 1, 2, 3, 5, 11, 12})
- }))
- end
- if not setSpawn and ground.X<400 and math.random()<0.75 then
- setSpawn=true
- ground.item=true
- table.insert(micestuff, 1, XML("T", {
- X=ground.X,
- Y=ground.Y-ground.H/2
- }))
- elseif not setCheese and ground.X>2400 and math.random()<ground.X/3200 then
- setCheese=true
- ground.item=true
- table.insert(micestuff, 2, XML("F", {
- X=ground.X,
- Y=ground.Y-ground.H/2-10
- }))
- elseif not setHole and ground.X>1600 and math.random()<ground.X/3200 then
- setHole=true
- ground.item=true
- table.insert(micestuff, 3, XML("T", {
- X=ground.X,
- Y=ground.Y-ground.H/2
- }))
- elseif math.random()<0.25+ground.L/400 then
- ground.item=true
- table.insert(objects, XML("O", {
- X=ground.X,
- Y=ground.Y-ground.H/2-20,
- C=table.random({14, 22, 11})
- }))
- end
- end
- while gprev.X+gprev.L/2<3200 do
- ground={
- T=6,
- X=gprev.X+gprev.L/2,
- L=math.random(2, 6)*40,
- H=math.random()<0.5 and 40 or math.random(6)*40
- }
- if ground.X+ground.L>3200 then
- ground.L=3200-ground.X
- end
- ground.X=ground.X+ground.L/2
- ground.Y=400-ground.H/2
- if math.random()<0.75 or ground.X+ground.L/2==3200 then
- makeGround(ground)
- if ground.H>gprev.H and gprev.L>80 or gprev.item==nil then
- for y=40, ground.H-gprev.H, 40 do
- table.insert(objects, XML("O", {
- X=ground.X-ground.L/2-20,
- Y=ground.Y-ground.H/2-20+y,
- C=15
- }))
- end
- end
- else
- ground.H=0
- end
- gprev=ground
- if ground.H<200 and gprev.H<200 and ground.H==0 or math.random()<0.25 then
- gfloat={
- T=6,
- X=gprev.X-gprev.L/2,
- Y=math.random(2, 4)*40+20,
- L=math.random(2, 4)*40,
- H=40
- }
- gfloat.X=gfloat.X+gfloat.L/2
- gfloat.X=gfloat.X-gfloat.X%40-(gfloat.L%80)/2
- while gfloat.X-gfloat.L/2<0 do
- gfloat.X=gfloat.X+40
- end
- if gfloat.X+gfloat.L/2<=ground.X+ground.L/2 then
- makeGround(gfloat)
- end
- end
- end
- while not setSpawn do
- makeGround({
- T=6,
- X=60,
- Y=100,
- L=120,
- H=40
- })
- end
- return table.concat({
- '<C><P title="',
- table.random({"La Plaine", "Terres lointaines", "La Prairie"}),
- '" F="',
- table.random({0, 1, 2, 7}),
- '" defilante="-1,-1,-1,1" L="3200" /><Z><S>',
- '<S X="400" N="" Y="5" T="12" H="10" P="0, 0, 0, 0, 0, 0, 0, 0" L="2400" o="324650" />',
- '<S X="2800" N="" Y="5" T="12" H="10" P="0, 0, 0, 0, 0, 0, 0, 0" L="2400" o="324650" />',
- table.concat(grounds),
- '</S><D>',
- table.concat(micestuff),
- '</D><O>',
- table.concat(objects),
- '</O></Z></C>'
- })
- end
- --New beginnings
- function eventNewGame()
- places=0
- ui.removeTextArea(-1)
- tfm.exec.setGameTime(120)
- tfm.exec.setNameColor(topmouse, 0xFFFF00)
- tfm.exec.chatMessage("<J>"..text.newRace)
- if tfm.get.room.xmlMapInfo then
- map.name=tfm.get.room.xmlMapInfo.xml:match('<P[^/]+title="([^"]+)"') or "Unknown"
- map.author=tfm.get.room.xmlMapInfo.author or "Tigrounette"
- local type, token
- for object in tfm.get.room.xmlMapInfo.xml:gmatch("<O [^/]+/>") do
- type=tonumber(object:match('C="(%d+)"'))
- if type==14 or type==22 or type==11 then
- table.insert(map.tokens, {
- x=tonumber(object:match('X="(%d+)"')) or 0,
- y=tonumber(object:match('Y="(%d+)"')) or 0,
- type=type==14 and 1 or type==22 and 2 or 3
- })
- end
- end
- end
- tfm.exec.setUIMapName("<J>"..map.name)
- tfm.exec.setUIShamanName("<J>"..topmouse.."<N> Top mouse! ")
- for name, player in pairs(tfm.get.room.playerList) do
- setPlayer(name)
- players[name].tokenImgs={}
- eventPlayerRespawn(name)
- updateInv(name)
- end
- end
- --A continuum
- function eventLoop(time, remaining, queue, seed)
- if remaining>30000 and places>0 then
- tfm.exec.setGameTime(30)
- elseif remaining>500 then
- local timestamp=os.time()
- for name, player in pairs(players) do
- if timestamp-player.rocketjump>400 and timestamp-player.rocketjump<2000 then
- local p=tfm.get.room.playerList[name]
- tfm.exec.displayParticle(29, p.x, p.y, 0, -2, 0, 0.1)
- end
- end
- else
- round=round+1
- if round%12==0 then
- local topscore=0
- tfm.exec.setNameColor(topmouse, 0)
- for name, player in pairs(tfm.get.room.playerList) do
- tfm.exec.setNameColor(name, 0)
- tfm.exec.setPlayerScore(name, 0)
- if player.score>topscore then
- topscore=player.score
- topmouse=name
- end
- end
- tfm.exec.chatMessage("<ROSE>"..text.wonRound:format(topmouse, topscore))
- end
- for i=1, #map.tokens*2+1 do
- ui.removeTextArea(i)
- end
- map.seed=nil
- map.tokens={}
- if round%#maps==1 then
- table.sort(maps, function() return math.random()>.5 end)
- end
- if queue then
- if seed then
- map.code=generateMap(queue)
- else
- map.code=queue
- end
- elseif round%seedmod==0 then
- map.code=generateMap()
- else
- map.code=maps[round%#maps+1]
- end
- tfm.exec.setGameTime(5)
- tfm.exec.newGame(map.code)
- end
- end
- --Click on sh*t
- function eventTextAreaCallback(id, name, callback)
- if callback=="help" then
- eventChatCommand(name, callback)
- elseif callback=="controls" then
- eventChatCommand(name, "help controls")
- elseif callback=="set_airjump" or callback=="set_bomb" then
- callback=callback=="set_airjump" and "airjump" or "bomb"
- tfm.exec.chatMessage(text.keySet:format(callback), name)
- players[name].keyset=callback
- for key=48, 57 do
- tfm.exec.bindKeyboard(name, key, true, true)
- end
- for key=65, 90 do
- tfm.exec.bindKeyboard(name, key, true, true)
- end
- elseif callback=="credits" then
- eventChatCommand(name, callback)
- elseif callback=="close" then
- ui.removeTAStyle(110)
- ui.removeTAStyle(120)
- ui.removeTAStyle(130)
- ui.removeTAStyle(140)
- ui.removeTAStyle(150)
- ui.removeTextArea(160)
- ui.removeTextArea(170)
- end
- end
- --Welcome to the jungle
- function eventNewPlayer(name)
- ui.addTAStyle(210, "<a href='event:help'> <font size='12'>?</font></a>", nil, 8, 30, 18, 18)
- ui.addTAStyle(220, "<a href='event:controls'> <font size='12'>c</font></a>", nil, 40, 30, 18, 18)
- ui.addTAStyle(230, "", nil, 72, 30, nil, 18)
- tfm.exec.chatMessage("<VP>"..text.greet:format("<N>derby<VP>"), name)
- tfm.exec.chatMessage("<T>"..text.greetSub:format("<N><b>!help</b><T>"), name)
- if roomtype.random then
- tfm.exec.chatMessage("<J>"..text.roomRandom, name)
- end
- if roomtype.advanced or tfm.get.room.playerList[name].inHardMode then
- tfm.exec.chatMessage("<J>"..text.roomAdvanced:format("<b>", "</b>"), name)
- end
- for i, piece in ipairs(getLook(name)) do
- if text.look["_"..i.."_"..piece] then
- tfm.exec.chatMessage("<J>"..text.look["_"..i.."_"..piece], name)
- break
- end
- end
- if isAdmin(name) then
- tfm.exec.chatMessage("<V>"..text.mgmtJoin:format(name))
- end
- players[name]={
- keys={},
- tokens={},
- tokenImgs={}
- }
- setPlayer(name)
- eventPlayerDied(name)
- for i, token in ipairs(map.tokens) do
- drawToken(i, name)
- end
- setTutorial(name)
- system.bindMouse(name)
- setKeys(name, defaultKeys)
- end
- --Rest with Elisah
- function eventPlayerDied(name)
- setPlayer(name)
- tfm.exec.chatMessage(text.respawn:format(3), name)
- if tfm.get.room.playerList[name].score>0 then
- tfm.exec.setPlayerScore(name, -1, true)
- end
- system.newTimer(function()
- tfm.exec.respawnPlayer(name)
- if name==topmouse then
- tfm.exec.setNameColor(name, 0xFFFF00)
- end
- end, 3000)
- end
- --Welcome back
- function eventPlayerRespawn(name)
- local player=players[name]
- player.advanced=roomtype.advanced or tfm.get.room.playerList[name].inHardMode
- for i, token in ipairs(map.tokens) do
- drawToken(i, name, true)
- drawToken(i, name, false)
- end
- player.tokens={}
- if topmouse==name then
- tfm.exec.addImage("5m7Rzyq.png", "$"..name, -15, -45, nil)
- end
- end
- --Good job
- function eventPlayerWon(name)
- setPlayer(name)
- places=places+1
- tfm.exec.setPlayerScore(name, math.max(1, 5-places)*5, true)
- if places==1 then
- tfm.exec.chatMessage("<J>"..text.wonRace:format(name))
- end
- end
- --Arrowrider 2.0
- function eventMouse(name, x, y)
- local player=players[name]
- if player.arrows>0 then
- player.arrows=player.arrows-1
- updateInv(name)
- if player.advanced then
- tfm.exec.addShamanObject(24, x, y)
- else
- player=tfm.get.room.playerList[name]
- local angle=math.atan2(y-player.y, x-player.x)
- tfm.exec.addShamanObject(35, player.x, player.y-20, math.deg(angle), math.cos(angle)*arrowSpeed, math.sin(angle)*arrowSpeed)
- end
- end
- end
- --The things newbs don't learn in !help
- function eventKeyboard(name, key, down, x, y)
- local player=players[name]
- if player.tutorial==key then
- ui.removeTextArea(-1, name)
- end
- if not player.keyset then
- local timestamp=os.time()
- if key==83 or key==40 then
- if down then
- player.rocketjump=timestamp
- else
- if timestamp-player.rocketjump>500 then
- tfm.exec.movePlayer(name, nil, nil, nil, nil, math.min(timestamp-player.rocketjump+250, 1500)/2, false)
- tfm.exec.displayParticle(3, x, y, -2, 0, 0.1, 0)
- tfm.exec.displayParticle(3, x, y, -2, 1, 0, 0)
- tfm.exec.displayParticle(3, x, y, 2, 0, -0.1, 0)
- tfm.exec.displayParticle(3, x, y, 2, 1, 0, 0)
- tfm.exec.displayParticle(4, x, y, 0, 0, 0, 0)
- end
- player.rocketjump=math.huge
- end
- elseif key==81 or key==37 then
- player.dashR=0
- if timestamp-player.dashL<200 and player.airjumps>0 then
- player.airjumps=player.airjumps-1
- updateInv(name)
- if player.advanced then
- tfm.exec.movePlayer(name, -90, 0, true)
- tfm.exec.displayParticle(36, x-60, y, 0, 0, 0, 0)
- else
- tfm.exec.movePlayer(name, nil, nil, nil, -40, nil, true)
- tfm.exec.displayParticle(27, x, y, 0, 0, 0, 0)
- tfm.exec.displayParticle(35, x, y, 20, 0, 0, 0)
- end
- else
- player.dashL=timestamp
- end
- elseif key==68 or key==39 then
- player.dashL=0
- if timestamp-player.dashR<200 and player.airjumps>0 then
- player.airjumps=player.airjumps-1
- updateInv(name)
- if player.advanced then
- tfm.exec.movePlayer(name, 90, 0, true)
- tfm.exec.displayParticle(36, x+60, y, 0, 0, 0, 0)
- else
- tfm.exec.movePlayer(name, nil, nil, nil, 40, nil, true)
- tfm.exec.displayParticle(26, x, y, 0, 0, 0, 0)
- tfm.exec.displayParticle(35, x, y, -20, 0, 0, 0)
- end
- else
- player.dashR=timestamp
- end
- elseif key==player.keys.pickup then
- for i, token in ipairs(map.tokens) do
- if math.abs(x-token.x)<20 and math.abs(y-token.y)<20 then
- if not player.tokens[i] then
- player.tokens[i]=true
- local item=({"airjumps", "arrows", "bombs"})[token.type]
- if item=="arrows" and player.advanced then
- player[item]=player[item]+math.floor(pickupCount/3)
- else
- player[item]=player[item]+pickupCount
- end
- updateInv(name)
- tfm.exec.displayParticle(15, token.x, token.y, 0, -1, 0, 0, name)
- drawToken(i, name, true)
- if player.tutorial==token then
- local key=({"I", "J", "K"})[token.type]
- ui.updateTextArea(-1, text.tutorialUse:format("<J>"..item.."<N>", "<J>"..key.."<N>"), name)
- item=item:sub(1, -2)
- if item=="arrow" then
- item="arrowLeft"
- end
- player.tutorial=player.keys[item]
- end
- end
- break
- end
- end
- elseif key==player.keys.airjump then
- if player.airjumps>0 then
- player.airjumps=player.airjumps-1
- updateInv(name)
- if player.advanced then
- local dist=math.min(90, y-30)
- tfm.exec.movePlayer(name, 0, -dist, true, 0, -1, false)
- tfm.exec.displayParticle(36, x, y-dist, 0, 0, 0, 0)
- else
- tfm.exec.movePlayer(name, nil, nil, nil, nil, -60, false)
- tfm.exec.displayParticle(4, x, y, -1, -1, 0, 0)
- tfm.exec.displayParticle(4, x, y, 0, -1, 0, 0)
- tfm.exec.displayParticle(4, x, y, 1, -1, 0, 0)
- end
- end
- elseif key==player.keys.bomb and player.bombs>0 then
- player.bombs=player.bombs-1
- updateInv(name)
- if player.advanced then
- ui.addTextArea(-3, "", name, x-2, y-2, 4, 4, 0xFF0000, 0xFFFFFF, 0.75)
- system.newTimer(function()
- ui.removeTextArea(-3, name)
- for i=1, mineBoom do
- tfm.exec.addShamanObject(24, x+math.random(-60, 60), y+math.random(-60, 60))
- end
- end, math.max(mineClock, 1000))
- else
- local id=tfm.exec.addShamanObject(23, x, y+30)
- system.newTimer(function()
- tfm.exec.removeObject(id)
- tfm.exec.addShamanObject(24, x, y+30)
- tfm.exec.explosion(x, y+30, bombPower, bombRadius, true)
- end, math.max(bombClock, 1000))
- end
- end
- elseif down then
- player.keys[player.keyset]=key
- player.keyset=nil
- for key=48, 57 do
- tfm.exec.bindKeyboard(name, key, true, false)
- end
- for key=65, 90 do
- tfm.exec.bindKeyboard(name, key, true, false)
- end
- setKeys(name, player.keys)
- eventChatCommand(name, "help controls")
- end
- end
- function eventChatCommand(name, message)
- local args={}
- local admin=isAdmin(name)
- local player=players[name]
- for arg in message:gmatch("[^%s]+") do
- table.insert(args, arg:lower())
- end
- message=message:match("%s(.*)") or ""
- if args[1]=="tutorial" then
- setTutorial(name)
- elseif args[1]=="help" or args[1]=="credits" then
- local content
- if args[1]=="credits" then
- content={
- text.helpCredits,
- text.helpCreditsCoding:format("Fxie"),
- text.helpCreditsTranslation:format(lang, text.author)
- }
- elseif args[2]=="tokens" then
- content={
- text.helpTokens,
- text.helpTokensGeneral,
- text.helpTokensHave:format("<VP>E<N>")
- }
- elseif args[2]=="controls" then
- content={
- text.helpControl,
- text.helpControlInstruct,
- "<font size='32' face='lucida sans unicode'> "..text.helpControlAirjump.."</font>",
- "<font size='32' face='lucida sans unicode'> "..text.helpControlBomb.."</font>"
- }
- else
- content={
- text.help,
- text.helpDash,
- text.helpRocketjump,
- text.helpArrows,
- text.helpAirjump:format(("<VP>%c<N>"):format(player.keys.airjump)),
- text.helpBombs:format(("<VP>%c<N>"):format(player.keys.bomb)),
- text.helpPickup:format(("<VP>%c<N>"):format(player.keys.pickup))
- }
- end
- content[1]="<font size='14'>"..content[1].."</font>"
- ui.addTAStyle(110, table.concat(content, "\n\n"), name, 200, 80, 400, 200)
- ui.addTAStyle(120, "<a href='event:help'>How to play</a>", name, 200, 296, 86, 16)
- ui.addTAStyle(130, "<a href='event:controls'>Controls</a>", name, 300, 296, 86, 16)
- ui.addTAStyle(140, "<a href='event:credits'>Credits</a>", name, 400, 296, 86, 16)
- ui.addTAStyle(150, "<a href='event:close'>X</a>", name, 584, 296, 16, 16)
- if args[2]=="controls" then
- ui.addTextArea(160, ("<font size='32'><b><a href='event:set_airjump'>%c </a></b></font>"):format(player.keys.airjump), name, 500, 136, 40, 40, 0x040404, 0x040404, 0.1, true)
- ui.addTextArea(170, ("<font size='32'><b><a href='event:set_bomb'>%c </a></b></font>"):format(player.keys.bomb), name, 500, 190, 40, 40, 0x040404, 0x040404, 0.1, true)
- else
- ui.removeTextArea(160)
- ui.removeTextArea(170)
- end
- elseif args[1]=="get" then
- if args[2]=="keys" then
- local keys={}
- for control, key in pairs(player.keys) do
- table.insert(keys, control)
- table.insert(keys, key)
- end
- tfm.exec.chatMessage(text.getKeys:format(table.concat(keys)), name)
- elseif args[2]=="maps" then
- tfm.exec.chatMessage(text.getMaps:format(#maps, table.concat(maps, ", ")), name)
- end
- elseif args[1]=="set" then
- if admin and args[3] then
- local variable, value=message:match("(.+) (.+)")
- value=tonumber(value) or tostring(value)
- if type(value)==type(_G[variable]) then
- _G[variable]=value
- tfm.exec.chatMessage("<N>"..name.." : Set <VP>"..variable.."<N> = <VP>"..value)
- else
- tfm.exec.chatMessage("<R>Invalid type", name)
- end
- end
- elseif args[1]=="map" then
- if map.seed then
- tfm.exec.chatMessage("<N>Now playing : map seed <VP>"..map.seed, name)
- else
- tfm.exec.chatMessage("<N>Now playing : <VP>"..map.code.."<N> by <VP>"..map.author, name)
- end
- elseif admin then
- if args[1]=="skip" then
- eventLoop(0, 0)
- elseif args[1]=="addmap" then
- table.insert(maps, args[2])
- elseif args[1]=="shaman" then
- tfm.exec.setShaman(name)
- elseif args[1]=="play" then
- eventLoop(0, 0, args[2], args[3]=="seed")
- elseif args[1]=="mod" then
- tfm.exec.chatMessage("<ROSE>[Room mod]<N> "..message)
- end
- end
- end
- --Hide spammands
- for i, command in ipairs({"help", "credits", "get", "set", "mod", "shaman"}) do
- system.disableChatCommandDisplay(command)
- end
- --Disability check
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoTimeLeft(true)
- --Diversity incorporated
- lang=tfm.get.room.community
- if text[lang] then
- text.look={}
- for id, message in pairs(text[lang]) do
- text[id]=message
- end
- elseif lang~="EN" and lang~="EN2" and lang~="INT" then
- tfm.exec.chatMessage("<R>There is no translation available for this community! ;_;\nIf you speak English and would like to translate, please contact Fxie.")
- end
- --Special rooms
- roomtype={}
- if tfm.get.room.name:match("%$random") then
- seedmod=1
- roomtype.random=true
- end
- if tfm.get.room.name:match("%$advanced") then
- seedmod=0
- roomtype.advanced=true
- end
- --Let's go!
- eventLoop(0, 0)
- for name, player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement