Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local magnet = ""
- local timeLeft = 0
- local settings = {
- maxVX = 150,
- maxVY = 150,
- }
- function getSpeed(data, data2)
- local abs = math.abs
- local direction = {x = 1, y = 1}
- if data.x < data2.x then direction.x = -1 end
- if data.y < data2.y then direction.y = -1 end
- local speed = {
- x = abs(data.x - data2.x) / 3,
- y = abs(data.y - data2.y) / 3,
- }
- if speed.x > settings.maxVX then speed.x = settings.maxVX end
- if speed.y > settings.maxVY then speed.y = settings.maxVY end
- speed.x = speed.x * direction.x
- speed.y = speed.y * direction.y
- return speed
- end
- function main()
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableMinimalistMode(true)
- tfm.exec.disablePhysicalConsumables(true)
- ui.addBotText("A reverse magnet effect is applied onto the shaman each round! Bring the cheese to the hole safely!", nil)
- newGame()
- end
- function newGame()
- tfm.exec.newGame("#V")
- end
- local tfm_exec_newGame = tfm.exec.newGame
- function tfm.exec.newGame(map)
- if map == "#V" then
- local vanilla = {}
- for num = 0, 143 do
- table.insert(vanilla, num)
- end
- for num = 200, 210 do
- table.insert(vanilla, num)
- end
- tfm_exec_newGame(vanilla[math.random(#vanilla)])
- else
- tfm_exec_newGame(map)
- end
- end
- function ui.addBotText(text, n)
- ui.addTextArea(100, "<v>[~Soupbot]<n> "..text, n, 6, 380, nil, 30, 0x324650, 0x171918, 0.7, true)
- end
- function eventNewGame()
- local selected = {n = "", score = 0}
- for n, data in pairs(tfm.get.room.playerList) do
- if data.score >= selected.score then
- selected.n = n
- selected.score = data.score
- end
- end
- magnet = selected.n
- tfm.exec.setShaman(magnet)
- ui.setShamanName("<rose> "..magnet)
- ui.addBotText("You must bring the mice to the cheese and the hole safely! A reverse magnet is applied onto you!", magnet)
- end
- function eventPlayerDied(n)
- local num, n2 = 0, ""
- for n, data in pairs(tfm.get.room.playerList) do
- if not data.isDead then num = num + 1 n2 = n end
- end
- if n == magnet or num <= 1 then
- if timeLeft > 5 then tfm.exec.setGameTime(5) end
- ui.addBotText("The shaman and the mice has failed this round!", nil)
- end
- end
- function eventPlayerWon(n)
- if n ~= magnet then
- local num = 0
- for n, data in pairs(tfm.get.room.playerList) do
- if not data.isDead then num = num + 1 end
- end
- if num == 1 then
- ui.addBotText("The shaman and the mice has succeeded this round!", nil)
- ui.addBotText("You have succeeded! Go in the hole!", magnet)
- end
- elseif timeLeft > 5 then
- tfm.exec.setGameTime(5)
- end
- end
- function eventLoop(passed, left)
- local data = tfm.get.room.playerList[magnet]
- if data and not data.isDead then
- for attracted, data2 in pairs(tfm.get.room.playerList) do
- if attracted ~= magnet then
- local speed = getSpeed(data, data2)
- tfm.exec.movePlayer(attracted, 0, 0, false, speed.x, speed.y, true)
- end
- end
- end
- if left <= 0 then
- newGame()
- end
- timeLeft = left / 1000
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment