Advertisement
thepowderguy

ClassicPowder extension

Apr 4th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.86 KB | None | 0 0
  1. FS_UI = Window:new(100, 100, 437, 155)
  2.  
  3. title = Label:new(20, 10, 200, 16, "\bo**** FALLING SAND EDITOR ****")
  4. elementdesc = Label:new(10, 65, 100, 16, "\bbElement coming out")
  5. widthdesc = Label:new(10, 95, 100, 16, "\bbWidth of stream (pix.)")
  6.  
  7. ach = Checkbox:new(120, 40, 16, 16, "\brStream 1")
  8. ach:checked(true)
  9. bch = Checkbox:new(200, 40, 16, 16, "\brStream 2")
  10. bch:checked(true)
  11. cch = Checkbox:new(280, 40, 16, 16, "\brStream 3")
  12. cch:checked(true)
  13. dch = Checkbox:new(360, 40, 16, 16, "\brStream 4")
  14. dch:checked(true)
  15.  
  16. STRONE = Textbox:new(120, 65, 67, 16, "", "Element here")
  17. STRTWO = Textbox:new(200, 65, 67, 16, "", "Element here")
  18. STRTHREE = Textbox:new(280, 65, 67, 16, "", "Element here")
  19. STRFOUR = Textbox:new(360, 65, 67, 16, "", "Element here")
  20.  
  21. SIZEONESL = Slider:new(120, 90, 67, 16, 32)
  22. SIZEONESL:value(4)
  23. SIZEONESL:onValueChanged(
  24.     function()
  25.         SIZEONE:text(SIZEONESL:value())
  26.     end
  27. )
  28. SIZETWOSL = Slider:new(200, 90, 67, 16, 32)
  29. SIZETWOSL:value(4)
  30. SIZETWOSL:onValueChanged(
  31.     function()
  32.         SIZETWO:text(SIZETWOSL:value())
  33.     end
  34. )
  35. SIZETHREESL = Slider:new(280, 90, 67, 16, 32)
  36. SIZETHREESL:value(4)
  37. SIZETHREESL:onValueChanged(
  38.     function()
  39.         SIZETHREE:text(SIZETHREESL:value())
  40.     end
  41. )
  42. SIZEFOURSL = Slider:new(360, 90, 67, 16, 32)
  43. SIZEFOURSL:value(4)
  44. SIZEFOURSL:onValueChanged(
  45.     function()
  46.         SIZEFOUR:text(SIZEFOURSL:value())
  47.     end
  48. )
  49.  
  50. SIZEONE = Label:new(120, 105, 67, 16, "")
  51. SIZETWO = Label:new(200, 105, 67, 16, "")
  52. SIZETHREE = Label:new(280, 105, 67, 16, "")
  53. SIZEFOUR = Label:new(360, 105, 67, 16, "")
  54.  
  55. closeButton = Button:new(10, 128, 417, 16, "\btFINISH")
  56. closeButton:action(function() interface.closeWindow(FS_UI) end)
  57.  
  58. settingsclassic = Button:new(247, 10, 85, 16, "\btCLASSIC MODE")
  59. settingsclassic:action(function() classic() end)
  60.  
  61. reset = Button:new(342, 10, 85, 16, "\btRESET ALL")
  62. reset:action(function() resetAll() end)
  63.  
  64. function open(key)
  65.     if key == "o" then
  66.         interface.showWindow(FS_UI)
  67.     end
  68. end
  69.  
  70. function classic()
  71.     ach:checked(true)
  72.     bch:checked(true)
  73.     cch:checked(true)
  74.     dch:checked(true)
  75.     STRONE:text("dust")
  76.     STRTWO:text("watr")
  77.     STRTHREE:text("salt")
  78.     STRFOUR:text("oil")
  79.     SIZEONESL:value(8)
  80.     SIZETWOSL:value(8)
  81.     SIZETHREESL:value(8)
  82.     SIZEFOURSL:value(8)
  83.     SIZEONE:text("8")
  84.     SIZETWO:text("8")
  85.     SIZETHREE:text("8")
  86.     SIZEFOUR:text("8")
  87. end
  88.  
  89. function resetAll()
  90.     ach:checked(true)
  91.     bch:checked(true)
  92.     cch:checked(true)
  93.     dch:checked(true)
  94.     STRONE:text("none")
  95.     STRTWO:text("none")
  96.     STRTHREE:text("none")
  97.     STRFOUR:text("none")
  98.     SIZEONESL:value(4)
  99.     SIZETWOSL:value(4)
  100.     SIZETHREESL:value(4)
  101.     SIZEFOURSL:value(4)
  102.     SIZEONE:text("4")
  103.     SIZETWO:text("4")
  104.     SIZETHREE:text("4")
  105.     SIZEFOUR:text("4")
  106. end
  107.  
  108. function FallingSand()
  109.     if STRONE:text() == "" or STRONE:text() == "0" then
  110.         STRONE:text("none")
  111.     end
  112.     if STRTWO:text() == "" or STRTWO:text() == "0" then
  113.         STRTWO:text("none")
  114.     end
  115.     if STRTHREE:text() == "" or STRTHREE:text() == "0" then
  116.         STRTHREE:text("none")
  117.     end
  118.     if STRFOUR:text() == "" or STRFOUR:text() == "0" then
  119.         STRFOUR:text("none")
  120.     end
  121.     if SIZEONE:text() == "" then
  122.         SIZEONE:text("4")
  123.     end
  124.     if SIZETWO:text() == "" then
  125.         SIZETWO:text("4")
  126.     end
  127.     if SIZETHREE:text() == "" then
  128.         SIZETHREE:text("4")
  129.     end
  130.     if SIZEFOUR:text() == "" then
  131.         SIZEFOUR:text("4")
  132.     end
  133.     local ox = 125
  134.     local y = 4
  135.     local x = ox
  136.     if ach:checked() == true then
  137.         for i = 1, SIZEONE:text() do
  138.             if tpt.get_property("type", x + i, y) == 0 and STRONE:text() ~= "none" then
  139.                 tpt.create(x + i, y, STRONE:text())
  140.             end
  141.         end
  142.     end
  143.     x = x + ox
  144.     if bch:checked() == true then
  145.         for i = 1, SIZETWO:text() do
  146.             if tpt.get_property("type", x + i, y) == 0 and STRTWO:text() ~= "none" then
  147.                 tpt.create(x + i, y, STRTWO:text())
  148.             end
  149.         end
  150.     end
  151.     x = x + ox
  152.     if cch:checked() == true then
  153.         for i = 1, SIZETHREE:text() do
  154.             if tpt.get_property("type", x + i, y) == 0 and STRTHREE:text() ~= "none" then
  155.                 tpt.create(x + i, y, STRTHREE:text())
  156.             end
  157.         end
  158.     end
  159.     x = x + ox
  160.     if dch:checked() == true then
  161.         for i = 1, SIZEFOUR:text() do
  162.             if tpt.get_property("type", x + i, y) == 0 and STRFOUR:text() ~= "none" then
  163.                 tpt.create(x + i, y, STRFOUR:text())
  164.             end
  165.         end
  166.     end
  167. end
  168.  
  169. FS_UI:addComponent(title)
  170. FS_UI:addComponent(elementdesc)
  171. FS_UI:addComponent(widthdesc)
  172.  
  173. FS_UI:addComponent(ach)
  174. FS_UI:addComponent(bch)
  175. FS_UI:addComponent(cch)
  176. FS_UI:addComponent(dch)
  177.  
  178. FS_UI:addComponent(STRONE)
  179. FS_UI:addComponent(STRTWO)
  180. FS_UI:addComponent(STRTHREE)
  181. FS_UI:addComponent(STRFOUR)
  182.  
  183. FS_UI:addComponent(SIZEONESL)
  184. FS_UI:addComponent(SIZETWOSL)
  185. FS_UI:addComponent(SIZETHREESL)
  186. FS_UI:addComponent(SIZEFOURSL)
  187.  
  188. FS_UI:addComponent(SIZEONE)
  189. FS_UI:addComponent(SIZETWO)
  190. FS_UI:addComponent(SIZETHREE)
  191. FS_UI:addComponent(SIZEFOUR)
  192.  
  193. FS_UI:addComponent(closeButton)
  194. FS_UI:addComponent(settingsclassic)
  195. FS_UI:addComponent(reset)
  196.  
  197. tpt.register_keypress(open)
  198. tpt.register_step(FallingSand)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement