Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Box={type=10, width=200, height=30, forerground=true, friction=0.3, restitution=0.2, angle=0, miceCollision=false, groundCollision=false}
- id={}
- obj={}
- x={}
- y={}
- checkCoords={}
- wait={}
- box={'<S><S X="396" L="30" o="6a7495" H="10" c="3" Y="-166" T="12" P="0,0,0.3,0.2,0,0,0,0" /><S P="0,0,0.3,0.2,90,0,0,0" L="30" o="6a7495" X="376" c="3" Y="-185" T="12" H="10" /><S H="10" L="30" o="6a7495" X="416" c="3" Y="-186" T="12" P="0,0,0.3,0.2,90,0,0,0" /><S P="0,0,0.3,0.2,0,0,0,0" L="30" o="6a7495" H="10" c="3" Y="-205" T="12" X="396" /><S P="0,0,0.3,0.2,0,0,0,0" L="794" o="6a7495" X="420" c="3" N="" Y="-229" T="12" H="150" />'}
- function updateMap()
- if tfm.get.room.xmlMapInfo and tfm.get.room.xmlMapInfo.author ~= "#Module" and tfm.get.room.xmlMapInfo.xml then
- xml = string.gsub(tfm.get.room.xmlMapInfo.xml, "<S>", box[1], 1)
- end
- return xml
- end
- function loadMap(xml)
- tfm.exec.newGame(xml)
- tfm.exec.setUIMapName("#<R>Transform<J>ice!<N>")
- end
- function hide(playerName)
- x[playerName]=tfm.get.room.playerList[playerName].x
- y[playerName]=tfm.get.room.playerList[playerName].y
- tfm.exec.movePlayer(playerName, 395, -185)
- obj[playerName]=tfm.exec.addShamanObject(54, x[playerName], y[playerName], 0, 0, 0, false)
- checkCoords[playerName]=true
- end
- function eventKeyboard(playerName, keyCode, down, xPosition, yPosition)
- if keyCode==32 and xPosition~=0 and yPosition~=0 and checkCoords[playerName]~=true and os.time() - wait[playerName] >= 1000 then
- hide(playerName)
- wait[playerName]=os.time()
- --end
- --if keyCode==32 and checkCoords[playerName]==true then
- elseif keyCode==32 and xPosition~=0 and yPosition~=0 and checkCoords[playerName]==true and os.time() - wait[playerName] >= 1000 then
- tfm.exec.removeObject(obj[playerName])
- tfm.exec.movePlayer(playerName, x[playerName], y[playerName])
- x[playerName]=nil
- y[playerName]=nil
- checkCoords[playerName]=nil
- obj[playerName]=nil
- wait[playerName]=os.time()
- end
- end
- function eventNewPlayer(playerName)
- tfm.exec.bindKeyboard(playerName, 32, true, true)
- if id[playerName]==nil then
- table.insert(id,playerName)
- id[playerName]=table.IndexOf(id, playerName)
- else
- end
- end
- function eventNewGame()
- for name, p in pairs(tfm.get.room.playerList) do
- wait[name]=0
- x[name]=nil
- y[name]=nil
- checkCoords[name]=nil
- obj[name]=nil
- end
- if tfm.get.room.xmlMapInfo and tfm.get.room.xmlMapInfo.author ~= "#Module" then
- updateMap()
- end
- end
- function eventLoop(a, timleft)
- if xml~=nil and a>3000 then
- tfm.exec.disableAutoShaman(false)
- loadMap(xml)
- tfm.exec.disableAutoShaman(true)
- xml = nil
- end
- for name, p in pairs(tfm.get.room.playerList) do
- if checkCoords[name]==true then
- x[name] = tfm.get.room.objectList[obj[name]].x
- y[name] = tfm.get.room.objectList[obj[name]].y
- end
- end
- end
- table.IndexOf=function(t, value)
- for i, v in ipairs(t) do
- if v==value then
- return i
- end
- end
- return false
- end
- for name, p in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement