Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.89 KB | None | 0 0
  1. string.split = function(value,pattern)
  2.     local out = {}
  3.     for k in value:gmatch(pattern) do
  4.         out[#out+1] = k or 0
  5.     end
  6.     return out
  7. end
  8.  
  9. draw = coroutine.wrap(function(id,xml)
  10.     local current = 0
  11.     while true do
  12.         tfm.exec.addPhysicObject(id,0,0,{
  13.             type = 14,
  14.             miceCollision = false,
  15.             groundCollision = false
  16.         }) 
  17.    
  18.         local jointTag = string.match(xml,"<L>(.-)</L>")
  19.         if jointTag then
  20.             for jointType,attributes in string.gmatch(jointTag,"<J(.-) (.-)/>") do
  21.                 if jointType == "D" or jointType == "PL" then
  22.                     local data = {}
  23.                    
  24.                     string.gsub(attributes,"([%-%w]+)=([\"'])(.-)%2",function(tag,_,value)
  25.                         data[tag] = tonumber(value) or value
  26.                     end)
  27.    
  28.                     local info = string.split(data.c,"[^,]+")
  29.                     tfm.exec.addJoint(current,id,id,{
  30.                         type = 0,
  31.                         point1 = data.P1,
  32.                         point2 = data.P2,
  33.                         point3 = data.P3,
  34.                         point4 = data.P4,
  35.                         color = tonumber(info[1],16),
  36.                         line = info[2],
  37.                         alpha = info[3],
  38.                         foreground = info[4] == "1"
  39.                     })
  40.                     current = current + 1
  41.                 end
  42.             end
  43.         end
  44.  
  45.         id,xml = coroutine.yield()
  46.     end
  47. end)
  48.  
  49. eventNewGame = function()
  50.     local joint = '<L><JD P1="35,91"P2="48,53"c="68b386,2"/><JD P1="48,53"P2="69,87"c="68b386,2"/><JD P1="69,87"P2="77,56"c="68b386,2"/><JD P1="94,61"P2="109,69"c="68b386,2"/><JD P1="109,70"P2="101,95"c="68b386,2"/><JD P1="104,82"P2="85,83"c="68b386,2"/><JD P1="85,83"P2="87,95"c="68b386,2"/><JD P1="88,96"P2="103,96"c="68b386,2"/><JD P1="123,57"P2="122,91"c="68b386,2"/><JD P1="122,91"P2="143,93"c="68b386,2"/><JD P1="143,93"P2="148,58"c="68b386,2"/><JD P1="148,58"P2="123,56"c="68b386,2"/><JD P1="207,59"P2="188,60"c="68b386,2"/><JD P1="188,60"P2="182,80"c="68b386,2"/><JD P1="182,81"P2="193,98"c="68b386,2"/><JD P1="193,98"P2="211,99"c="68b386,2"/><JD P1="236,63"P2="226,94"c="68b386,2"/><JD P1="226,94"P2="235,109"c="68b386,2"/><JD P1="237,109"P2="256,106"c="68b386,2"/><JD P1="257,105"P2="265,84"c="68b386,2"/><JD P1="265,82"P2="257,65"c="68b386,2"/><JD P1="257,65"P2="237,61"c="68b386,2"/><JD P1="277,106"P2="283,67"c="68b386,2"/><JD P1="283,67"P2="305,107"c="68b386,2"/><JD P1="305,107"P2="305,66"c="68b386,2"/><JD P1="346,70"P2="318,80"c="68b386,2"/><JD P1="318,80"P2="347,102"c="68b386,2"/><JD P1="347,102"P2="315,110"c="68b386,2"/><JD P1="360,102"P2="358,69"c="68b386,2"/><JD P1="376,84"P2="401,91"c="68b386,2"/><JD P1="401,91"P2="386,110"c="68b386,2"/><JD P1="387,110"P2="373,106"c="68b386,2"/><JD P1="372,105"P2="366,70"c="68b386,2"/><JD P1="366,70"P2="391,70"c="68b386,2"/><JD P1="413,71"P2="415,113"c="68b386,2"/><JD P1="415,113"P2="443,113"c="68b386,2"/><JD P1="443,113"P2="442,75"c="68b386,2"/><JD P1="442,75"P2="412,69"c="68b386,2"/><JD P1="494,76"P2="490,119"c="68b386,2"/><JD P1="493,102"P2="525,92"c="68b386,2"/><JD P1="525,92"P2="495,78"c="68b386,2"/><JD P1="534,80"P2="559,89"c="68b386,2"/><JD P1="559,89"P2="547,121"c="68b386,2"/><JD P1="550,107"P2="517,104"c="68b386,2"/><JD P1="517,104"P2="518,117"c="68b386,2"/><JD P1="518,117"P2="558,121"c="68b386,2"/><JD P1="572,82"P2="574,122"c="68b386,2"/><JD P1="574,99"P2="581,85"c="68b386,2"/><JD P1="581,85"P2="594,86"c="68b386,2"/><JD P1="604,81"P2="625,85"c="68b386,2"/><JD P1="625,85"P2="614,131"c="68b386,2"/><JD P1="618,108"P2="587,107"c="68b386,2"/><JD P1="587,107"P2="588,127"c="68b386,2"/><JD P1="588,128"P2="621,133"c="68b386,2"/><JD P1="636,132"P2="633,84"c="68b386,2"/><JD P1="633,109"P2="641,87"c="68b386,2"/><JD P1="641,87"P2="661,90"c="68b386,2"/><JD P1="307,137"P2="310,179"c="68b386,2"/><JD P1="308,157"P2="285,172"c="68b386,2"/><JD P1="285,172"P2="310,179"c="68b386,2"/><JD P1="317,145"P2="334,146"c="68b386,2"/><JD P1="317,144"P2="316,174"c="68b386,2"/><JD P1="316,175"P2="330,175"c="68b386,2"/><JD P1="317,159"P2="331,159"c="68b386,2"/><JD P1="351,197"P2="318,215"c="68b386,2"/><JD P1="318,215"P2="350,233"c="68b386,2"/><JD P1="367,194"P2="366,230"c="68b386,2"/><JD P1="366,218"P2="380,216"c="68b386,2"/><JD P1="380,216"P2="381,232"c="68b386,2"/><JD P1="392,197"P2="390,230"c="68b386,2"/><JD P1="390,230"P2="408,229"c="68b386,2"/><JD P1="408,227"P2="410,198"c="68b386,2"/><JD P1="410,198"P2="388,195"c="68b386,2"/><JD P1="417,203"P2="420,233"c="68b386,2"/><JD P1="420,220"P2="427,205"c="68b386,2"/><JD P1="427,205"P2="448,206"c="68b386,2"/><JD P1="462,200"P2="474,209"c="68b386,2"/><JD P1="474,209"P2="465,239"c="68b386,2"/><JD P1="468,221"P2="446,220"c="68b386,2"/><JD P1="446,220"P2="446,232"c="68b386,2"/><JD P1="446,232"P2="474,240"c="68b386,2"/><JD P1="487,208"P2="487,238"c="68b386,2"/><JD P1="486,224"P2="501,211"c="68b386,2"/><JD P1="501,211"P2="518,211"c="68b386,2"/><L /></L>'
  51.     draw(0,joint)
  52.     joint = '<L><JPL P1="64,226"P3="68,237"P4="73,246"P2="79,254"c="3490c2,18,1,1"/><JPL P1="79,254"P3="85,259"P4="92,263"P2="98,266"c="3490c2,18,1,1"/><JPL P1="98,266"P3="105,267"P4="110,267"P2="116,266"c="3490c2,18,1,1"/><JPL P1="116,266"P3="120,264"P4="123,262"P2="125,258"c="3490c2,18,1,1"/><JPL P1="125,258"P3="125,255"P4="124,251"P2="120,246"c="3490c2,18,1,1"/><JPL P1="120,246"P3="114,242"P4="106,237"P2="95,233"c="3490c2,18,1,1"/><JPL P1="95,233"P3="81,229"P4="64,226"P2="81,229"c="3490c2,18,1,1"/><JPL P1="161,261"P3="178,247"P4="192,236"P2="204,228"c="3490c2,18,1,1"/><JPL P1="204,228"P3="214,224"P4="221,222"P2="226,222"c="3490c2,18,1,1"/><JPL P1="226,222"P3="229,224"P4="231,227"P2="230,232"c="3490c2,18,1,1"/><JPL P1="230,232"P3="229,237"P4="225,243"P2="221,249"c="3490c2,18,1,1"/><JPL P1="221,249"P3="216,255"P4="209,260"P2="202,265"c="3490c2,18,1,1"/><JPL P1="202,265"P3="195,268"P4="187,269"P2="178,269"c="3490c2,18,1,1"/><JPL P1="178,269"P3="170,266"P4="161,261"P2="170,266"c="3490c2,18,1,1"/><JPL P1="73,311"P3="73,312"P4="75,309"P2="77,308"c="3490c2,18,1,1"/><JPL P1="77,308"P3="81,305"P4="85,303"P2="89,300"c="3490c2,18,1,1"/><JPL P1="89,300"P3="95,297"P4="101,294"P2="108,291"c="3490c2,18,1,1"/><JPL P1="108,291"P3="116,289"P4="124,287"P2="133,285"c="3490c2,18,1,1"/><JPL P1="133,285"P3="142,285"P4="152,285"P2="162,286"c="3490c2,18,1,1"/><JPL P1="162,286"P3="173,288"P4="184,292"P2="195,297"c="3490c2,18,1,1"/><JPL P1="195,297"P3="207,304"P4="219,312"P2="207,304"c="3490c2,18,1,1"/><JD P1="75,270"P2="74,286"c="64a2c4,11,1,1"/><JD P1="74,292"P2="74,310"c="64a2c4,11,1,1"/><JD P1="72,315"P2="75,330"c="64a2c4,11,1,1"/><JD P1="79,334"P2="83,347"c="64a2c4,11,1,1"/><JD P1="83,353"P2="83,358"c="64a2c4,11,1,1"/><JD P1="97,288"P2="95,310"c="64a2c4,11,1,1"/><JD P1="97,321"P2="99,327"c="64a2c4,11,1,1"/><JD P1="101,333"P2="102,341"c="64a2c4,11,1,1"/><JD P1="105,351"P2="106,360"c="64a2c4,11,1,1"/><JD P1="211,281"P2="210,290"c="64a2c4,11,1,1"/><JD P1="210,301"P2="208,311"c="64a2c4,11,1,1"/><JD P1="206,329"P2="204,336"c="64a2c4,11,1,1"/><JD P1="203,345"P2="200,357"c="64a2c4,11,1,1"/><JD P1="200,362"P2="200,369"c="64a2c4,11,1,1"/><JD P1="200,373"P2="199,376"c="64a2c4,11,1,1"/><JD P1="184,294"P2="179,311"c="64a2c4,11,1,1"/><JD P1="176,327"P2="176,337"c="64a2c4,11,1,1"/><JD P1="176,362"P2="175,372"c="64a2c4,11,1,1"/><JD P1="173,387"P2="172,396"c="64a2c4,11,1,1"/><L /></L>'
  53.     draw(1,joint)
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement