Advertisement
powderisfalling

PowderIsFalling Mod

Dec 14th, 2012
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.40 KB | None | 0 0
  1. -- INSTALLATION (for those who don't know how) :
  2. --
  3. -- - Copy to a text editor (Notepad, Notepad++, SciTE, ....)
  4. -- - Save as Autorun.lua
  5. -- - Place Autorun.lua to Powder Toy directory OR to scripts folder if you use Script Manager
  6. -- - Run Powder toy
  7. -- - Play ! OR if you use Script Manager, enable this mod in the ui
  8. --
  9. --
  10. --  PowderIsFalling Script V4.0
  11. --
  12. --
  13. ----CODE----------------------------------------------------------------------------------------------
  14. --
  15. --
  16. ----ELEMENTS
  17. --
  18. -- UPTE {
  19.  
  20.     local element1 = elements.allocate("PIFMOD", "UPTE")
  21.     elements.element(elements.PIFMOD_PT_UPTE, elements.element(elements.DEFAULT_PT_DMND))
  22.     elements.property(elements.PIFMOD_PT_UPTE, "Name", "UPTE")
  23.     elements.property(elements.PIFMOD_PT_UPTE, "Description", "Unidentified-Powder-Toy-Element. Try it yourself.")
  24.     elements.property(elements.PIFMOD_PT_UPTE, "Colour", 0xffffff)
  25.     elements.property(elements.PIFMOD_PT_UPTE, "MenuSection", 8)
  26.     elements.property(elements.PIFMOD_PT_UPTE, "Gravity", 1)
  27.     elements.property(elements.PIFMOD_PT_UPTE, "Loss", 0.8)
  28.     elements.property(elements.PIFMOD_PT_UPTE, "AirLoss", 0.01)
  29.     elements.property(elements.PIFMOD_PT_UPTE, "AirDrag", 0)
  30.     elements.property(elements.PIFMOD_PT_UPTE, "Advection", 0.5)
  31.     elements.property(elements.PIFMOD_PT_UPTE, "Weight", 5)
  32.     elements.property(elements.PIFMOD_PT_UPTE, "Diffusion", 0.5)
  33.     --elements.property(elements.PIFMOD_PT_UPTE, "Properties", PROP_nil_nil)
  34.     --elements.property(elements.PIFMOD_PT_UPTE, "Properties", PROP_nil_nil_nil)
  35.  
  36. -- UPTE }
  37. --
  38. -- BREZ {
  39.  
  40.     local element1 = elements.allocate("PIFMOD", "BREZ")
  41.     elements.element(elements.PIFMOD_PT_BREZ, elements.element(elements.DEFAULT_PT_DMND))
  42.     elements.property(elements.PIFMOD_PT_BREZ, "Name", "BREZ")
  43.     elements.property(elements.PIFMOD_PT_BREZ, "Description", "BREEZE element. Freeze the surroundings.")
  44.     elements.property(elements.PIFMOD_PT_BREZ, "Colour", 0xbebeff)
  45.     elements.property(elements.PIFMOD_PT_BREZ, "MenuSection", 8)
  46.     elements.property(elements.PIFMOD_PT_BREZ, "Gravity", 0)
  47.     elements.property(elements.PIFMOD_PT_BREZ, "Loss", 0.2)
  48.     elements.property(elements.PIFMOD_PT_BREZ, "AirLoss", 0)
  49.     elements.property(elements.PIFMOD_PT_BREZ, "AirDrag", 0)
  50.     elements.property(elements.PIFMOD_PT_BREZ, "Advection", 0.2)
  51.     elements.property(elements.PIFMOD_PT_BREZ, "Weight", 0)
  52.     elements.property(elements.PIFMOD_PT_BREZ, "Diffusion", 0.2)
  53.     --elements.property(elements.PIFMOD_PT_UPTE, "Properties", PROP_nil_nil)
  54.     --elements.property(elements.PIFMOD_PT_UPTE, "Properties", PROP_nil_nil_nil)
  55.  
  56. -- BREZ }
  57. --
  58. -- CHIL {
  59.  
  60.     local element1 = elements.allocate("PIFMOD", "CHIL")
  61.     elements.element(elements.PIFMOD_PT_CHIL, elements.element(elements.DEFAULT_PT_PHOT))
  62.     elements.property(elements.PIFMOD_PT_CHIL, "Name", "CHIL")
  63.     elements.property(elements.PIFMOD_PT_CHIL, "Description", "CHILL element. Very cold element. It weaken the life force of the surroundings.")
  64.     elements.property(elements.PIFMOD_PT_CHIL, "Colour", 0xdfdfff)
  65.     --elements.property(elements.PIFMOD_PT_CHIL, "MenuSection", 8)
  66.     --elements.property(elements.PIFMOD_PT_CHIL, "Gravity", 0)
  67.     --elements.property(elements.PIFMOD_PT_CHIL, "Loss", 0.2)
  68.     --elements.property(elements.PIFMOD_PT_CHIL, "AirLoss", 0)
  69.     --elements.property(elements.PIFMOD_PT_CHIL, "AirDrag", 0)
  70.     --elements.property(elements.PIFMOD_PT_CHIL, "Advection", 0.2)
  71.     --elements.property(elements.PIFMOD_PT_CHIL, "Weight", 0)
  72.     --elements.property(elements.PIFMOD_PT_CHIL, "Diffusion", 0.2)
  73.     --elements.property(elements.PIFMOD_PT_UPTE, "Properties", PROP_nil_nil)
  74.     --elements.property(elements.PIFMOD_PT_UPTE, "Properties", PROP_nil_nil_nil)
  75.  
  76. -- CHIL }
  77. --
  78. -- VIRS {
  79.  
  80.     local element1 = elements.allocate("PIFMOD", "VIRS")
  81.      elements.element(elements.PIFMOD_PT_VIRS, elements.element(elements.DEFAULT_PT_GAS))
  82.     elements.property(elements.PIFMOD_PT_VIRS, "Name", "VIRS")
  83.     elements.property(elements.PIFMOD_PT_VIRS, "Description", "Virus!")
  84.     elements.property(elements.PIFMOD_PT_VIRS, "Colour", 0xff9c9c)
  85.     elements.property(elements.PIFMOD_PT_VIRS, "MenuSection", 6)
  86.     elements.property(elements.PIFMOD_PT_VIRS, "Gravity", 0)
  87.     --elements.property(elements.PIFMOD_PT_VIRS, "Loss", nil)
  88.     --elements.property(elements.PIFMOD_PT_VIRS, "AirLoss", nil)
  89.     --elements.property(elements.PIFMOD_PT_VIRS, "AirDrag", nil)
  90.     --elements.property(elements.PIFMOD_PT_VIRS, "Advection", nil)
  91.     elements.property(elements.PIFMOD_PT_VIRS, "Weight", 0)
  92.     --elements.property(elements.PIFMOD_PT_VIRS, "Diffusion", nil)
  93.     elements.property(elements.PIFMOD_PT_VIRS, "Properties", PROP_LIFE_DEC)
  94.     elements.property(elements.PIFMOD_PT_VIRS, "Properties", PROP_LIFE_KILL_DEC)
  95.  
  96. -- VIRS }
  97. --
  98. ----FUNCTIONS
  99. --
  100. -- UPTE {
  101.  
  102. function upte(i, x, y, s, n)
  103.     tpt.set_property("temp", 90000, x, y)
  104.     tpt.create(x+1, y+1, "bray")
  105.     tpt.create(x-1, y-1, "bray")
  106.     tpt.create(x+1, y-1, "bray")
  107.     tpt.create(x-1, y+1, "bray")
  108. end
  109.  
  110. -- UPTE }
  111. --
  112. -- BREZ {
  113.  
  114. function brez(i, x, y, s, n)
  115.  
  116.     -- Create Flames And Set Life
  117.  
  118.     tpt.create(x+1, y+1, "cflm")
  119.     tpt.create(x-1, y-1, "cflm")
  120.     tpt.create(x+1, y-1, "cflm")
  121.     tpt.create(x-1, y+1, "cflm")
  122.  
  123.     tpt.set_property("life", 90, x+1, y+1)
  124.     tpt.set_property("life", 90, x-1, y-1)
  125.     tpt.set_property("life", 90, x+1, y-1)
  126.     tpt.set_property("life", 90, x-1, y+1)
  127.  
  128.     -- Self property set
  129.  
  130.     tpt.set_property("temp", -273, x, y)
  131.  
  132.     -- | TEMP SET FOR SURROUNDINGS | --
  133.  
  134.     xx = {1,-1,1,-1,0,0,1,-1,2,-2,2,-2,2,-2,1,-1,2,-2,1,-1,0,0,2,-2}
  135.     yy = {1,-1,-1,1,1,-1,0,0,2,-2,-2,2,1,-1,2,-2,-1,1,-2,2,2,-2,0,0}
  136.     for i = 1, 24 do
  137.         tpt.set_property("temp", -273, x+xx[i], y+yy[i])
  138.     end
  139.  
  140. end
  141.  
  142. -- BREZ }
  143. --
  144. -- SETT {
  145.  
  146. function set(xt, yt, bt, et)
  147.     if et == 2 and xt < 613 and yt < 384 then
  148.         at = tpt.get_property("type", xt, yt)
  149.         if at == tpt.el.wifi.id then
  150.             ct = tpt.input("WIFI Setting", "Type the channel (1 - 900)")
  151.             if tonumber(ct) == nil then
  152.                 tpt.log("Cancelled.")
  153.                 tpt.delete(xt, yt)
  154.             else
  155.                 gt = tonumber(ct)+273.15
  156.                 tpt.set_property("temp", gt, x, y)
  157.             end
  158.         end
  159.     end
  160.     if et == 2 and xt < 613 and yt < 384 then
  161.         at = tpt.get_property("type", xt, yt)
  162.         if at == tpt.el.prto.id then
  163.             ct = tpt.input("PRTO Setting", "Type the channel (1 - 900)")
  164.             if tonumber(ct) == nil then
  165.                 tpt.log("Cancelled.")
  166.                 tpt.delete(xt, yt)
  167.             else
  168.                 gt = tonumber(ct)+273.15
  169.                 tpt.set_property("temp", gt, x, y)
  170.             end
  171.         end
  172.     end
  173.         if et == 2 and xt < 613 and yt < 384 then
  174.         at = tpt.get_property("type", xt, yt)
  175.         if at == tpt.el.prti.id then
  176.             ct = tpt.input("PRTI Setting", "Type the channel (1 - 900)")
  177.             if tonumber(ct) == nil then
  178.                 tpt.log("Cancelled.")
  179.                 tpt.delete(xt, yt)
  180.             else
  181.                 gt = tonumber(ct)+273.15
  182.                 tpt.set_property("temp", gt, x, y)
  183.             end
  184.         end
  185.     end
  186. end
  187.  
  188. -- SETT }
  189. --
  190. -- CHIL {
  191.  
  192. function chil(i, x, y, s, n)
  193.     tpt.set_property("temp", -1000, x, y)
  194.     tpt.create(x+1, y+1, "cflm")
  195.     tpt.create(x-1, y-1, "cflm")
  196.     tpt.create(x+1, y-1, "cflm")
  197.     tpt.create(x-1, y+1, "cflm")
  198.     tpt.set_property("temp", -1000, x+1, y+1)
  199.     tpt.set_property("temp", -1000, x-1, y-1)
  200.     tpt.set_property("temp", -1000, x+1, y-1)
  201.     tpt.set_property("temp", -1000, x-1, y+1)
  202.     tpt.set_property("life", 90, x+1, y+1)
  203.     tpt.set_property("life", 90, x-1, y-1)
  204.     tpt.set_property("life", 90, x+1, y-1)
  205.     tpt.set_property("life", 90, x-1, y+1)
  206.  
  207. end
  208.  
  209. -- CHIL }
  210. --
  211. -- FPSC {
  212. function keydet(key, keyx, modifier, events)
  213.     if key == "t" then
  214.         answer = tpt.input("Max FPS", "Type new max FPS :")
  215.         if tonumber(answer) == nil then
  216.             tpt.log("Cancelled.")
  217.         else
  218.             tpt.setfpscap(tonumber(answer))
  219.         end
  220.     end
  221. end
  222. -- FPSC }
  223. --
  224. -- VIRS {
  225.  
  226. function v_spread(i, x, y, s, n)
  227.     tick1 = math.random(1, 10)
  228.     if tick1 == 1 then
  229.         xxx = {1,-1,1,-1,1,0,-1,0}
  230.         yyy = {1,-1,-1,1,0,1,0,-1}
  231.         for l = 1, 8 do
  232.             tpt.set_property("type", "VIRS", x+xxx[l], y+yyy[l])
  233.         end
  234.     end
  235.     tick2 = math.random(1, 100)
  236.     if tick2 == 50 then
  237.         tpt.delete(x, y)
  238.     end
  239. end
  240.  
  241. -- VIRS }
  242. --
  243. ----FUNCTION SETS
  244. --
  245. -- UPTE {
  246. tpt.element_func(upte, elements.PIFMOD_PT_UPTE)
  247. -- UPTE }
  248. --
  249. -- BREZ {
  250. tpt.element_func(brez, elements.PIFMOD_PT_BREZ)
  251. -- BREZ }
  252. --
  253. -- WIFI {
  254. tpt.register_mouseclick(set)
  255. -- WIFI }
  256. --
  257. -- CHIL {
  258. tpt.element_func(chil, elements.PIFMOD_PT_CHIL)
  259. -- CHIL }
  260. --
  261. -- FPSC {
  262. tpt.register_keypress(keydet)
  263. -- FPSC }
  264. --
  265. -- VIRS {
  266. tpt.element_func(v_spread, elements.PIFMOD_PT_VIRS)
  267. -- VIRS }
  268. --
  269. ----END-OF-CODE---------------------------------------------------------------------------------------
  270. --
  271. -- Thanks for using this script!
  272. --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement