powderisfalling

PIFMOD 2.0.0

Mar 19th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.14 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 2.0.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. -- BFLM {
  79.  
  80.     local element1 = elements.allocate("PIFMOD", "BFLM")
  81.      elements.element(elements.PIFMOD_PT_BFLM, elements.element(elements.DEFAULT_PT_SMKE))
  82.     elements.property(elements.PIFMOD_PT_BFLM, "Name", "BFLM")
  83.     elements.property(elements.PIFMOD_PT_BFLM, "Description", "Black Flame. (Like Amaterasu)")
  84.     elements.property(elements.PIFMOD_PT_BFLM, "Colour", 0x191919)
  85.     elements.property(elements.PIFMOD_PT_BFLM, "MenuSection", 15)
  86.     elements.property(elements.PIFMOD_PT_BFLM, "Gravity", 0)
  87.     --elements.property(elements.PIFMOD_PT_BFLM, "Loss", nil)
  88.     --elements.property(elements.PIFMOD_PT_BFLM, "AirLoss", nil)
  89.     --elements.property(elements.PIFMOD_PT_BFLM, "AirDrag", nil)
  90.     --elements.property(elements.PIFMOD_PT_BFLM, "Advection", nil)
  91.     elements.property(elements.PIFMOD_PT_BFLM, "Weight", 0)
  92.     --elements.property(elements.PIFMOD_PT_BFLM, "Diffusion", nil)
  93.     elements.property(elements.PIFMOD_PT_BFLM, "Properties", PROP_LIFE_DEC)
  94.     --elements.property(elements.PIFMOD_PT_BFLM, "Properties", PROP_LIFE_KILL_DEC)
  95.  
  96. -- BFLM }
  97. --
  98. -- WFLM {
  99.  
  100.     local element1 = elements.allocate("PIFMOD", "WFLM")
  101.      elements.element(elements.PIFMOD_PT_WFLM, elements.element(elements.DEFAULT_PT_SMKE))
  102.     elements.property(elements.PIFMOD_PT_WFLM, "Name", "WFLM")
  103.     elements.property(elements.PIFMOD_PT_WFLM, "Description", "White Flame.")
  104.     elements.property(elements.PIFMOD_PT_WFLM, "Colour", 0xffffff)
  105.     elements.property(elements.PIFMOD_PT_WFLM, "MenuSection", 6)
  106.     elements.property(elements.PIFMOD_PT_WFLM, "Gravity", 0)
  107.     --elements.property(elements.PIFMOD_PT_WFLM, "Loss", nil)
  108.     --elements.property(elements.PIFMOD_PT_WFLM, "AirLoss", nil)
  109.     --elements.property(elements.PIFMOD_PT_WFLM, "AirDrag", nil)
  110.     --elements.property(elements.PIFMOD_PT_WFLM, "Advection", nil)
  111.     elements.property(elements.PIFMOD_PT_WFLM, "Weight", 0)
  112.     --elements.property(elements.PIFMOD_PT_WFLM, "Diffusion", nil)
  113.     elements.property(elements.PIFMOD_PT_WFLM, "Properties", nil)
  114.     elements.property(elements.PIFMOD_PT_WFLM, "Properties", nil)
  115.  
  116. -- WFLM }
  117. --
  118. -- DELE {
  119.  
  120.     local element1 = elements.allocate("PIFMOD", "DELE")
  121.     elements.element(elements.PIFMOD_PT_DELE, elements.element(elements.DEFAULT_PT_DMND))
  122.     elements.property(elements.PIFMOD_PT_DELE, "Name", "DELE")
  123.     elements.property(elements.PIFMOD_PT_DELE, "Description", "DELE.")
  124.     --elements.property(elements.PIFMOD_PT_DELE, "Colour", 0xffffff)
  125.     elements.property(elements.PIFMOD_PT_DELE, "MenuSection", 8)
  126.     elements.property(elements.PIFMOD_PT_DELE, "Gravity", 1)
  127.     elements.property(elements.PIFMOD_PT_DELE, "Loss", 0.8)
  128.     elements.property(elements.PIFMOD_PT_DELE, "AirLoss", 0.01)
  129.     elements.property(elements.PIFMOD_PT_DELE, "AirDrag", 0)
  130.     elements.property(elements.PIFMOD_PT_DELE, "Advection", 0.5)
  131.     elements.property(elements.PIFMOD_PT_DELE, "Weight", 5)
  132.     elements.property(elements.PIFMOD_PT_DELE, "Diffusion", 0.5)
  133.     --elements.property(elements.PIFMOD_PT_DELE, "Properties", PROP_nil_nil)
  134.     --elements.property(elements.PIFMOD_PT_DELE, "Properties", PROP_nil_nil_nil)
  135.  
  136. -- DELE }
  137. --
  138. ----FUNCTIONS
  139. --
  140. -- UPTE {
  141.  
  142. function upte(i, x, y, s, n)
  143.     tpt.set_property("temp", 90000, x, y)
  144.     tpt.create(x+1, y+1, "bray")
  145.     tpt.create(x-1, y-1, "bray")
  146.     tpt.create(x+1, y-1, "bray")
  147.     tpt.create(x-1, y+1, "bray")
  148. end
  149.  
  150. -- UPTE }
  151. --
  152. -- BREZ {
  153.  
  154. function brez(i, x, y, s, n)
  155.  
  156.     -- Create Flames And Set Life
  157.  
  158.     tpt.create(x+1, y+1, "cflm")
  159.     tpt.create(x-1, y-1, "cflm")
  160.     tpt.create(x+1, y-1, "cflm")
  161.     tpt.create(x-1, y+1, "cflm")
  162.  
  163.     tpt.set_property("life", 90, x+1, y+1)
  164.     tpt.set_property("life", 90, x-1, y-1)
  165.     tpt.set_property("life", 90, x+1, y-1)
  166.     tpt.set_property("life", 90, x-1, y+1)
  167.  
  168.     -- Self property set
  169.  
  170.     tpt.set_property("temp", -273, x, y)
  171.  
  172.     -- | TEMP SET FOR SURROUNDINGS | --
  173.  
  174.     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}
  175.     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}
  176.     for i = 1, 24 do
  177.         tpt.set_property("temp", -273, x+xx[i], y+yy[i])
  178.     end
  179.  
  180. end
  181.  
  182. -- BREZ }
  183. --
  184. -- SETT {
  185.  
  186. function set(xt, yt, bt, et)
  187.     if et == 2 and xt < 613 and yt < 384 then
  188.         at = tpt.get_property("type", xt, yt)
  189.         if at == tpt.el.wifi.id then
  190.             ct = tpt.input("WIFI Setting", "Type the channel (1 - 900)")
  191.             if tonumber(ct) == nil then
  192.                 tpt.log("Cancelled.")
  193.             else
  194.                 gt = tonumber(ct)+273.15
  195.                 tpt.set_property("temp", gt, x, y)
  196.             end
  197.         end
  198.     end
  199.     if et == 2 and xt < 613 and yt < 384 then
  200.         at = tpt.get_property("type", xt, yt)
  201.         if at == tpt.el.prto.id then
  202.             ct = tpt.input("PRTO Setting", "Type the channel (1 - 900)")
  203.             if tonumber(ct) == nil then
  204.                 tpt.log("Cancelled.")
  205.             else
  206.                 gt = tonumber(ct)+273.15
  207.                 tpt.set_property("temp", gt, x, y)
  208.             end
  209.         end
  210.     end
  211.         if et == 2 and xt < 613 and yt < 384 then
  212.         at = tpt.get_property("type", xt, yt)
  213.         if at == tpt.el.prti.id then
  214.             ct = tpt.input("PRTI Setting", "Type the channel (1 - 900)")
  215.             if tonumber(ct) == nil then
  216.                 tpt.log("Cancelled.")
  217.             else
  218.                 gt = tonumber(ct)+273.15
  219.                 tpt.set_property("temp", gt, x, y)
  220.             end
  221.         end
  222.     end
  223. end
  224.  
  225. -- SETT }
  226. --
  227. -- CHIL {
  228.  
  229. function chil(i, x, y, s, n)
  230.     tpt.set_property("temp", -1000, x, y)
  231.     tpt.create(x+1, y+1, "cflm")
  232.     tpt.create(x-1, y-1, "cflm")
  233.     tpt.create(x+1, y-1, "cflm")
  234.     tpt.create(x-1, y+1, "cflm")
  235.     tpt.set_property("temp", -1000, x+1, y+1)
  236.     tpt.set_property("temp", -1000, x-1, y-1)
  237.     tpt.set_property("temp", -1000, x+1, y-1)
  238.     tpt.set_property("temp", -1000, x-1, y+1)
  239.     tpt.set_property("life", 90, x+1, y+1)
  240.     tpt.set_property("life", 90, x-1, y-1)
  241.     tpt.set_property("life", 90, x+1, y-1)
  242.     tpt.set_property("life", 90, x-1, y+1)
  243.  
  244. end
  245.  
  246. -- CHIL }
  247. --
  248. -- FPSC {
  249.  
  250. function keydet(key, keyx, modifier, events)
  251.     if key == "t" then
  252.         answer = tpt.input("Max FPS", "Type new max FPS :")
  253.         if tonumber(answer) == nil then
  254.             tpt.log("Cancelled.")
  255.         else
  256.             tpt.setfpscap(tonumber(answer))
  257.         end
  258.     end
  259. end
  260.  
  261. -- FPSC }
  262. --
  263. -- BFLM {
  264.  
  265. function bflm_spred(i, x, y, s, n)
  266.     tick1 = math.random(1, 10)
  267.     if tick1 == 1 then
  268.         xxx = {1,-1,1,-1,1,0,-1,0}
  269.         yyy = {1,-1,-1,1,0,1,0,-1}
  270.         for l = 1, 8 do
  271.             tpt.set_property("type", "WFLM", x+xxx[l], y+yyy[l])
  272.         end
  273.     end
  274.     tick2 = math.random(1, 16)
  275.     if tick2 == 8 then
  276.         tpt.delete(x, y)
  277.     end
  278. end
  279.  
  280. -- BFLM }
  281. --
  282. -- WFLM {
  283.  
  284. function WFLM_spred(i, x, y, s, n)
  285.     tpt.set_property("life", "100", x, y)
  286.     tick1 = math.random(1, 10)
  287.     if tick1 == 1 then
  288.         xxx = {1,-1,1,-1,1,0,-1,0}
  289.         yyy = {1,-1,-1,1,0,1,0,-1}
  290.         for l = 1, 8 do
  291.             tpt.set_property("type", "BFLM", x+xxx[l], y+yyy[l])
  292.         end
  293.     end
  294.     tick2 = math.random(1, 16)
  295.     if tick2 == 8 then
  296.         tpt.delete(x, y)
  297.     end
  298. end
  299.  
  300. -- WFLM }
  301. --
  302. -- DELE {
  303.  
  304. function DELE(i, x, y, s, n)
  305.     tpt.set_property("life", "100", x, y)
  306.     tick1 = math.random(1, 10)
  307.     if tick1 == 1 then
  308.         xxx = {1,-1,1,-1,1,0,-1,0}
  309.         yyy = {1,-1,-1,1,0,1,0,-1}
  310.         for l = 1, 8 do
  311.             tpt.set_property("type", "WFLM", x+xxx[l], y+yyy[l])
  312.         end
  313.     end
  314. end
  315.  
  316. ----FUNCTION SETS
  317. --
  318. -- UPTE {
  319. tpt.element_func(upte, elements.PIFMOD_PT_UPTE)
  320. -- UPTE }
  321. --
  322. -- BREZ {
  323. tpt.element_func(brez, elements.PIFMOD_PT_BREZ)
  324. -- BREZ }
  325. --
  326. -- WIFI {
  327. tpt.register_mouseclick(set)
  328. -- WIFI }
  329. --
  330. -- CHIL {
  331. tpt.element_func(chil, elements.PIFMOD_PT_CHIL)
  332. -- CHIL }
  333. --
  334. -- FPSC {
  335. tpt.register_keypress(keydet)
  336. -- FPSC }
  337. --
  338. -- BFLM {
  339. tpt.element_func(bflm_spred, elements.PIFMOD_PT_BFLM)
  340. -- BFLM }
  341. --
  342. -- WFLM {
  343. tpt.element_func(WFLM_spred, elements.PIFMOD_PT_WFLM)
  344. -- WFLM }
  345. --
  346. -- DELE {
  347. tpt.element_func(DELE, elements.PIFMOD_PT_DELE)
  348. -- DELE }
  349. --
  350. ----END-OF-CODE---------------------------------------------------------------------------------------
  351. --
  352. -- Thanks for using this script!
  353. --
Advertisement
Add Comment
Please, Sign In to add comment