Skip to content

Instantly share code, notes, and snippets.

@xDeda
Created September 15, 2021 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xDeda/20679bf10a0a5a2dc05be8f333da5144 to your computer and use it in GitHub Desktop.
Save xDeda/20679bf10a0a5a2dc05be8f333da5144 to your computer and use it in GitHub Desktop.
monobridge grav 0 module for Transformice
-- #monobridge by Tactcat#0000
-- 2 minutes of no gravity, 30 seconds of gravity
-- !go to turn on gravity early
-- shift+click to tp on
players={}
KEYS={
SHIFT=16,
CTRL=17,
U=85
}
frozen = false
roundshaman = "Tigrounette#0001"
mapInfo={
lastLoad=os.time()-5000,
queue={},
}
tfm.exec.disableAutoNewGame(true)
tfm.exec.disableAllShamanSkills(true)
tfm.exec.disableAfkDeath(true)
tfm.exec.disablePhysicalConsumables(true)
tfm.exec.disableAutoScore(true)
-- tfm.exec.newGame("@7870693") -- @7870692
function playMap(map)
local timeSinceLastLoad=os.time()-mapInfo.lastLoad
if timeSinceLastLoad<=3000 then
--tfm.exec.chatMessage("Error. Map trying to reload: "..map)
local timeUntilNextLoad=3000-timeSinceLastLoad
if timeUntilNextLoad<1000 then timeUntilNextLoad=1000 end
if mapInfo.timer then system.removeTimer(mapInfo.timer) mapInfo.timer=nil end
mapInfo.timer=system.newTimer(function(...)
local arg={...}
--tfm.exec.chatMessage("Reloading "..tostring(arg[2]))
playMap(arg[2])
end,timeUntilNextLoad,false,map,map)
else
--tfm.exec.chatMessage("Map "..map.." loaded!")
tfm.exec.newGame(map,false)
mapInfo.lastLoad=os.time()
end
end
function eventLoop(time,remaining)
if remaining<=0 then
tfm.exec.newGame("#4")
end
if remaining<=30000 and frozen==true then
frozen = false
tfm.exec.setWorldGravity(nil, nil)
for n,player in pairs(tfm.get.room.playerList) do
tfm.exec.freezePlayer(n,false)
if player.isShaman then
tfm.exec.setShaman(n,false)
tfm.exec.setPlayerScore(n, 0, false)
end
end
end
end
function eventNewGame()
print("A new round has just started.")
tfm.exec.setGameTime(150, true)
tfm.exec.setWorldGravity(nil, 0)
frozen = true
for n,player in pairs(tfm.get.room.playerList) do
if player.isShaman then
roundshaman = n
print(n.." is shaman")
--tfm.exec.setShamanMode(n,2)
else
tfm.exec.freezePlayer(n,true)
end
end
end
function eventPlayerDied()
local i=0
for n,player in pairs(tfm.get.room.playerList) do
if not player.isDead then
i=i+1
end
end
if i==0 then
tfm.exec.newGame("#4")
end
end
function eventNewPlayer(name)
system.bindMouse(name,true)
tfm.exec.bindKeyboard(name,KEYS.SHIFT,true,true)
tfm.exec.bindKeyboard(name,KEYS.SHIFT,false,true)
players[name] = { shift = false }
end
function eventMouse(name,x,y)
if players[name].shift and tfm.get.room.playerList[name].isShaman == true then
tfm.exec.movePlayer(name,x,y,false,0,0,false)
end
end
function eventKeyboard(name, key, down, x, y)
if key==KEYS.SHIFT and down==true then
players[name].shift=true
elseif key==KEYS.SHIFT and down==false then
players[name].shift=false
end
end
function eventChatCommand(name,message)
print(name.." said "..message)
if message:sub(0,3) == "map" then
playMap(message:sub(5))
end
if message:sub(0,1) == "s" and #message == 1 then
for name2,player in pairs(tfm.get.room.playerList) do
if name2 == name then
tfm.exec.setPlayerScore(name2,1,false)
else
tfm.exec.setPlayerScore(name2,0,false)
end
end
else
print(message:sub(3))
for name2,player in pairs(tfm.get.room.playerList) do
if name2 == message:sub(3) then
tfm.exec.setPlayerScore(message:sub(3),1,false)
else
tfm.exec.setPlayerScore(name2,0,false)
end
end
end
if tfm.get.room.playerList[name].isShaman == true and message:sub(0,2) == "go" then
frozen = false
tfm.exec.setWorldGravity(0, 10)
for n,player in pairs(tfm.get.room.playerList) do
tfm.exec.freezePlayer(n,false)
if player.isShaman then
tfm.exec.setShaman(n,false)
tfm.exec.setPlayerScore(n, 0, false)
end
end
end
if name == roundshaman and message:sub(0,4) == "skip" then
playMap("#4")
end
end
for name,player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
end
function eventPlayerWon(playerName, timeElapsed, timeElapsedSinceRespawn)
if playerName == roundshaman then
tfm.exec.setPlayerScore(playerName, -1, false)
else
tfm.exec.setPlayerScore(playerName, 10, true)
end
eventPlayerDied()
end
tfm.exec.newGame("#4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment