Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def={}
- joints={}
- dodraw=true
- timeleft=0
- timeadded=0
- def[1]={30, 30}
- def[2]={60, 60}
- def[3]={100, 10}
- def[4]={200, 10}
- def[6]={30, 30}
- function eventLoop(time, remaining)
- timeleft=remaining
- if dodraw then
- local o
- for i=1, #joints do
- o=tfm.get.room.objectList[joints[i][1]]
- if o then
- tfm.exec.addJoint(i*3+2, 255, 255, {
- point1=joints[i][4],
- point2=math.floor(o.x)..","..math.floor(o.y),
- line=1,
- color=0xffffff,
- alpha=0.5,
- foreground=true
- })
- end
- end
- end
- end
- function eventNewGame()
- clearJoints()
- joints={}
- timeadded=0
- tfm.exec.addPhysicObject(255, 0, 800, {
- miceCollision=false,
- groundCollision=false
- })
- end
- function eventNewPlayer(name)
- tfm.exec.bindKeyboard(name, 73, true, true)
- tfm.exec.bindKeyboard(name, 79, true, true)
- tfm.exec.bindKeyboard(name, 85, true, true)
- end
- function eventKeyboard(name, key)
- if tfm.get.room.playerList[name].isShaman then
- if key==73 then
- timeleft=timeleft+30000
- timeadded=timeadded+30
- tfm.exec.setGameTime(math.floor(timeleft/1000))
- elseif key==79 then
- for _name, player in pairs(tfm.get.room.playerList) do
- if _name~=name then
- tfm.exec.setPlayerScore(_name, -1, false)
- end
- end
- tfm.exec.newGame(tfm.get.room.currentMap)
- elseif key==85 then
- dodraw=not dodraw
- if dodraw then drawJoints()
- else clearJoints() end
- end
- end
- end
- function drawJoints()
- ui.addTextArea(999, "<font color='#000000'>+"..timeadded.."s", nil, 6, 28,
- nil, nil, 0, 0, 0, true)
- for i=1, #joints do
- ui.addTextArea(i, "<font color='#000000'>"..i, nil, joints[i][2], joints[i][3],
- nil, nil, 0, 0, 0, true)
- tfm.exec.addJoint(i*3, 255, 255, {
- point1=joints[i][6],
- point2=joints[i][7],
- line=joints[i][8],
- color=0x00ff00,
- alpha=0.3
- })
- tfm.exec.addJoint(i*3+1, 255, 255, {
- point1=joints[i][4],
- point2=joints[i][5],
- line=20,
- color=0xffffff,
- alpha=0.6,
- foreground=true
- })
- end
- end
- function clearJoints()
- ui.removeTextArea(999)
- for i=1, #joints do
- ui.removeTextArea(i)
- tfm.exec.removeJoint(i*3)
- tfm.exec.removeJoint(i*3+1)
- tfm.exec.removeJoint(i*3+2)
- end
- end
- function eventSummoningEnd(name, type, x, y, angle, xs, ys, data, other)
- if def[type] then
- angle=angle/180*math.pi
- local p=def[type]
- local d=p[1]/2-p[2]/2
- local p1, p2=math.floor(math.cos(angle)*d), math.floor(math.sin(angle)*d)
- if p1==p2 then p2=p2+1 end
- table.insert(joints, {
- data.id,
- x-5, y-6,
- x..","..y,
- x..","..(y+1),
- (x+p1)..","..(y+p2),
- (x-p1)..","..(y-p2),
- p[2]
- })
- if dodraw then drawJoints() end
- end
- end
- tfm.exec.disableAutoTimeLeft(true)
- for name, player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement