Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco (previously Fxie)
- --Made in: 06/05/2016
- --Last update: 26/05/2016
- --[[ Notes:
- Does:
- Grava a construção o shaman utilizando joints
- Commands:
- !
- time --> Altera o tempo
- int --> Tempo em minutos
- color --> Muda a cor da joint caso você seja o shaman
- clear --> Remove objetos/joints
- ? --> Caso tenha um segundo argumento, apenas os objetos serão deletados, poupando as joints.
- ]]--
- lines={}
- object={
- [1] = {30,30}, --box 1
- [2] = {60,60}, --box 2
- [3] = {100,10}, --plank 1
- [4] = {200,10}, --plank 2
- [6] = {30,30}, --ball
- [7] = {100,20}, --trampoline
- [10] = {50,25}, --anvil
- [57] = {80,55}, --cloud
- [60] = {50,10}, --tiny plank
- [61] = {50,50}, --companion crate
- [67] = {305,10}, --big plank
- [68] = {90,70}, --triangle
- }
- able_drawLine=true
- shaman_colour = 0x00ff00
- eventLoop=function(currentTime)
- if able_drawLine then
- local o
- for i=1,#lines do
- o=tfm.get.room.objectList[lines[i][1]]
- if o then
- tfm.exec.addJoint(i*3+2,255,255,{
- point1=lines[i][4],
- point2=math.floor(o.x)..","..math.floor(o.y),
- line=1,
- color=0xffffff,
- alpha=.5,
- foreground=true
- })
- end
- end
- end
- end
- eventNewGame=function()
- clear()
- lines={}
- shaman_colour = 0x00ff00
- tfm.exec.addPhysicObject(255,0,800,{
- miceCollision=false,
- groundCollision=false
- })
- end
- draw=function()
- for i=1, #lines do
- ui.addTextArea(i,"<font color='#000000'>"..i,n,lines[i][2],lines[i][3],nil,nil,0,0,0,false)
- tfm.exec.addJoint(i*3,255,255,{
- point1=lines[i][6],
- point2=lines[i][7],
- line=lines[i][8],
- color=shaman_colour,
- alpha=.3
- })
- tfm.exec.addJoint(i*3+1,255,255,{
- point1=lines[i][4],
- point2=lines[i][5],
- line=20,
- color=0xffffff,
- alpha=0.6,
- foreground=true
- })
- end
- end
- clear=function()
- for i=1,#lines do
- ui.removeTextArea(i)
- tfm.exec.removeJoint(i*3)
- tfm.exec.removeJoint(i*3+1)
- tfm.exec.removeJoint(i*3+2)
- end
- end
- eventSummoningEnd=function(n,o,x,y,a,xs,ys,set)
- local objectReplace = {
- [1] = {100,200},
- [2] = {200,300},
- [3] = {300,400},
- [4] = {400,600},
- [6] = {600,700},
- [7] = {700,800},
- [10] = {1000,1700}
- }
- for k,v in next,objectReplace do
- if o>v[1] and o<v[2] then
- o = k
- break
- end
- end
- if object[o] then
- local angle=a/180*math.pi
- local obj=object[o]
- local dir=obj[1]/2-obj[2]/2
- local p1,p2=math.floor(math.cos(angle)*dir),math.floor(math.sin(angle)*dir)
- if p1==p2 then p2=p2+1 end
- table.insert(lines,{
- set.id,
- x-5,y-6,
- x..","..y,
- x..","..(y+1),
- (x+p1)..","..(y+p2),
- (x-p1)..","..(y-p2),
- obj[2]
- })
- if able_drawLine then draw() end
- end
- end
- eventChatCommand=function(n,c)
- if tfm.get.room.playerList[n].isShaman then
- if c:lower():sub(1,4)=="time" then
- tfm.exec.setGameTime(tonumber(c:sub(6))*60)
- end
- if c:lower() == "color" then
- ui.showColorPicker(0,n,shaman_colour,"Recorder Color")
- end
- if c:lower():sub(1,5) == "clear" then
- local idList={}
- for id in next,tfm.get.room.objectList do table.insert(idList,id) end
- for k,v in next,idList do tfm.exec.removeObject(v) end
- idList={}
- if c:lower():sub(7)=="" then clear();lines={} end
- end
- end
- end
- eventColorPicked=function(i,n,c) shaman_colour = c end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement