Advertisement
TPT_PL

Particle Dungeon 2

Jan 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.37 KB | None | 0 0
  1. local backtab = elem.allocate("MAZE", "BBACK") -- The BACK button, defined before all for a good effect :P
  2. -- Heroes
  3. local warrior = elem.allocate("MAZE", "WARR")
  4. local cleric = elem.allocate("MAZE", "CLRC")
  5. -- Monsters
  6. local rat = elem.allocate("MAZE", "RAT")
  7. local piranha = elem.allocate("MAZE", "PRNH")
  8. local zombie = elem.allocate("MAZE", "ZOMB")
  9. -- Tiles
  10. local floor = elem.allocate("MAZE", "FLOOR")
  11. local mud = elem.allocate("MAZE", "MUD")
  12. local acid = elem.allocate("MAZE", "ACDW")
  13. local trap = elem.allocate("MAZE", "TRAP")
  14. -- Magicka
  15. local firebolt = elem.allocate("MAZE", "BOLT")
  16.  
  17. elem.element(warrior, elem.element(elem.DEFAULT_PT_DMND))
  18. elem.property(warrior, "Name", "WARR")
  19. elem.property(warrior, "Description", "Warrior, fights monsters (especially those zombies, ugh). Very strong, often misses though.")
  20. elem.property(warrior, "Color", 0x993300)
  21.  
  22. elem.element(cleric, elem.element(elem.DEFAULT_PT_DMND))
  23. elem.property(cleric, "Name", "CLRC")
  24. elem.property(cleric, "Description", "Clerics, can heal warriors, but have mere experience with fighting.")
  25. elem.property(cleric, "Color", 0xFFFF99)
  26.  
  27. elem.element(rat, elem.element(elem.DEFAULT_PT_DMND))
  28. elem.property(rat, "Name", "RAT")
  29. elem.property(rat, "Description", "Rat, one of the monsters. Quicker than humans, but less tough and weaker. Reproduces quickly.")
  30. elem.property(rat, "Color", 0x555555)
  31.  
  32. elem.element(piranha, elem.element(elem.DEFAULT_PT_DMND))
  33. elem.property(piranha, "Name", "PRNH")
  34. elem.property(piranha, "Description", "Piranha, lives in water. Aggresive attacks warriors and clerics.")
  35. elem.property(piranha, "Color", 0x339966)
  36.  
  37. elem.element(zombie, elem.element(elem.DEFAULT_PT_DMND))
  38. elem.property(zombie, "Name", "ZOMB")
  39. elem.property(zombie, "Description", "Zombie, can turn enemies into other zombies. Its weakness is water and acid water. If they don't kill, they die.")
  40. elem.property(zombie, "Color", 0x009900)
  41.  
  42. elem.element(floor, elem.element(elem.DEFAULT_PT_DMND))
  43. elem.property(floor, "Name", "FLOR")
  44. elem.property(floor, "Description", "The floor of dungeon. Draw on it with various elements.")
  45. elem.property(floor, "Color", 0xAAAAAA)
  46. elem.property(floor, "Properties", elem.TYPE_SOLID+elem.PROP_LIFE_DEC+elem.PROP_DRAWONCTYPE)
  47.  
  48. elem.element(trap, elem.element(elem.DEFAULT_PT_DMND))
  49. elem.property(trap, "Name", "TRAP")
  50. elem.property(trap, "Description", "Trap, draw on it with ACDW or RAT to change its mode. Normally kills warriors and clerics.")
  51. elem.property(trap, "Color", 0xAA0000)
  52. elem.property(trap, "Properties", elem.TYPE_SOLID+elem.PROP_DRAWONCTYPE)
  53.  
  54. elem.element(mud, elem.element(elem.DEFAULT_PT_DMND))
  55. elem.property(mud, "Name", "MUD")
  56. elem.property(mud, "Description", "Muddy, murky water, good home for piranhas but nobody else. Warriors and clerics can pass through it.")
  57. elem.property(mud, "Color", 0x376D88)
  58. elem.property(mud, "Properties", elem.TYPE_SOLID+elem.PROP_LIFE_DEC)
  59.  
  60. elem.element(acid, elem.element(elem.DEFAULT_PT_DMND))
  61. elem.property(acid, "Name", "ACDW")
  62. elem.property(acid, "Description", "Acidic water, hurts anyone who passes it and burns nearby floor.")
  63. elem.property(acid, "Color", 0x00DDDD)
  64. elem.property(acid, "Properties", elem.TYPE_SOLID+elem.PROP_LIFE_DEC)
  65.  
  66. elem.element(firebolt, elem.element(elem.DEFAULT_PT_DMND))
  67. elem.property(firebolt, "Name", "BOLT")
  68. elem.property(firebolt, "Description", "Firebolt, when activated by any touch begins to accumulate energy to violently explode after a while.")
  69. elem.property(firebolt, "Color", 0xFF9900)
  70. elem.property(firebolt, "Properties", elem.TYPE_SOLID+elem.PROP_LIFE_DEC)
  71.  
  72. local function walking(i, x, y, s, nt)
  73.     if sim.partProperty(i, "pavg0") == 0 then
  74.         sim.partProperty(i, "life", 100)
  75.         sim.partProperty(i, "ctype", floor)
  76.         sim.partProperty(i, "pavg0", 1)
  77.     end
  78.     local r = sim.partID(x+math.random(-1, 1), y+math.random(-1, 1))
  79.     if r ~= nil then
  80.         local rtype = sim.partProperty(r, "type")
  81.         if (rtype == floor or rtype == mud or rtype == acid) and sim.partProperty(r, "life") == 0 and math.random(1, 2) == 1 then
  82.             local life = sim.partProperty(i, "life")
  83.             sim.partChangeType(i, sim.partProperty(i, "ctype"))
  84.             sim.partProperty(i, "life", 10)
  85.             sim.partChangeType(r, warrior)
  86.             sim.partProperty(r, "ctype", rtype)
  87.             sim.partProperty(r, "life", life)
  88.             sim.partProperty(i, "ctype", 0)
  89.             sim.partProperty(r, "pavg0", 1)
  90.             return 1
  91.         elseif (rtype == rat or rtype == piranha or rtype == zombie) and math.random(0, 1) == 1 then
  92.             if rtype == zombie then
  93.                 sim.partProperty(r, "life", sim.partProperty(r, "life")-math.random(3, 5))
  94.             else
  95.                 sim.partProperty(r, "life", sim.partProperty(r, "life")-math.random(1, 5))
  96.             end
  97.         elseif rtype == trap and sim.partProperty(r, "ctype") ~= rat then
  98.             sim.partProperty(r, "tmp", 1)
  99.         end
  100.     end
  101.     if math.random(1, 20) == 1 and sim.partProperty(i, "life") < 100 then
  102.         sim.partProperty(i, "life", sim.partProperty(i, "life")+1)
  103.     end
  104.     if sim.partProperty(i, "life") <= 0 then
  105.         sim.partChangeType(i, sim.partProperty(i, "ctype"))
  106.         sim.partProperty(i, "life", 10)
  107.         return 1
  108.     end
  109.     if sim.partProperty(i, "ctype") == acid then
  110.         sim.partProperty(i, "life", sim.partProperty(i, "life")-math.random(0, 1))
  111.     end
  112. end
  113.  
  114. elem.property(warrior, "Update", walking)
  115.  
  116. local function clericing(i, x, y, s, nt)
  117.     if sim.partProperty(i, "pavg0") == 0 then
  118.         sim.partProperty(i, "life", 50)
  119.         sim.partProperty(i, "ctype", floor)
  120.         sim.partProperty(i, "pavg0", 1)
  121.     end
  122.     local r = sim.partID(x+math.random(-1, 1), y+math.random(-1, 1))
  123.     if r ~= nil then
  124.         local rtype = sim.partProperty(r, "type")
  125.         if (rtype == floor or rtype == mud or rtype == acid) and sim.partProperty(r, "life") == 0 and math.random(1, 2) == 1 then
  126.             local life = sim.partProperty(i, "life")
  127.             sim.partChangeType(i, sim.partProperty(i, "ctype"))
  128.             sim.partProperty(i, "life", 10)
  129.             sim.partChangeType(r, cleric)
  130.             sim.partProperty(r, "ctype", rtype)
  131.             sim.partProperty(r, "life", life)
  132.             sim.partProperty(i, "ctype", 0)
  133.             sim.partProperty(r, "pavg0", 1)
  134.             return 1
  135.         elseif (rtype == rat or rtype == piranha or rtype == zombie) and math.random(0, 1) == 1 then
  136.             if rtype == zombie then
  137.                 sim.partProperty(r, "life", sim.partProperty(r, "life")-math.random(1, 4))
  138.             else
  139.                 sim.partProperty(r, "life", sim.partProperty(r, "life")-math.random(1, 2))
  140.             end
  141.         elseif rtype == warrior and sim.partProperty(r, "life") <= 95 then
  142.             sim.partProperty(r, "life", sim.partProperty(r, "life")+math.random(1,5))
  143.         elseif rtype == trap and sim.partProperty(r, "ctype") ~= rat then
  144.             sim.partProperty(r, "tmp", 1)
  145.         end
  146.     end
  147.     if math.random(1, 20) == 1 and sim.partProperty(i, "life") < 50 then
  148.         sim.partProperty(i, "life", sim.partProperty(i, "life")+1)
  149.     end
  150.     if sim.partProperty(i, "life") <= 0 then
  151.         sim.partChangeType(i, sim.partProperty(i, "ctype"))
  152.         sim.partProperty(i, "life", 10)
  153.         return 1
  154.     end
  155.     if sim.partProperty(i, "ctype") == acid then
  156.         sim.partProperty(i, "life", sim.partProperty(i, "life")-math.random(0, 1))
  157.     end
  158. end
  159.  
  160. elem.property(cleric, "Update", clericing)
  161.  
  162. local function ratting(i, x, y, s, nt)
  163.     if sim.partProperty(i, "pavg0") == 0 then
  164.         sim.partProperty(i, "life", 25)
  165.         sim.partProperty(i, "ctype", floor)
  166.         sim.partProperty(i, "pavg0", 1)
  167.     end
  168.     local r = sim.partID(x+math.random(-1, 1), y+math.random(-1, 1))
  169.     if r ~= nil then
  170.         local rtype = sim.partProperty(r, "type")
  171.         if (rtype == floor or rtype == acid) and sim.partProperty(r, "life") == 0 then
  172.             local life = sim.partProperty(i, "life")
  173.             if math.random(1, 300) == 1 then
  174.                 sim.partChangeType(i, rat)
  175.                 sim.partProperty(i, "pavg0", 0)
  176.             else
  177.                 sim.partChangeType(i, sim.partProperty(i, "ctype"))
  178.                 sim.partProperty(i, "life", 10)
  179.                 sim.partProperty(i, "ctype", 0)
  180.             end
  181.             sim.partChangeType(r, rat)
  182.             sim.partProperty(r, "life", life)
  183.             sim.partProperty(r, "ctype", rtype)
  184.             sim.partProperty(r, "pavg0", 1)
  185.         elseif rtype == warrior or rtype == cleric or rtype == zombie then
  186.             sim.partProperty(r, "life", sim.partProperty(r, "life")-math.random(1, 2))
  187.         elseif rtype == trap and sim.partProperty(r, "ctype") == rat then
  188.             sim.partProperty(r, "tmp", 1)
  189.         end
  190.     end
  191.     if sim.partProperty(i, "life") <= 0 then
  192.         sim.partChangeType(i, floor)
  193.         sim.partProperty(i, "life", 10)
  194.     end
  195.     if sim.partProperty(i, "ctype") == acid then
  196.         sim.partProperty(i, "life", sim.partProperty(i, "life")-math.random(0, 1))
  197.     end
  198. end
  199.  
  200. elem.property(rat, "Update", ratting)
  201.  
  202. local function swimming(i, x, y, s, nt)
  203.     if sim.partProperty(i, "pavg0") == 0 then
  204.         sim.partProperty(i, "life", 50)
  205.         sim.partProperty(i, "pavg0", 1)
  206.     end
  207.     local r = sim.partID(x+math.random(-1, 1), y+math.random(-1, 1))
  208.     if r ~= nil then
  209.         local rtype = sim.partProperty(r, "type")
  210.         if rtype == mud and sim.partProperty(r, "life") == 0 then
  211.             local life = sim.partProperty(i, "life")
  212.             sim.partChangeType(i, mud)
  213.             sim.partProperty(i, "life", 10)
  214.             sim.partProperty(i, "ctype", 0)
  215.             sim.partChangeType(r, piranha)
  216.             sim.partProperty(r, "life", life)
  217.             sim.partProperty(r, "pavg0", 1)
  218.         elseif (rtype == warrior or rtype == cleric) and math.random(1, 5) ~= 1 then
  219.             sim.partProperty(r, "life", sim.partProperty(r, "life")-math.random(2, 3))
  220.         end
  221.     end
  222.     if sim.partProperty(i, "life") <= 0 then
  223.         sim.partChangeType(i, mud)
  224.         sim.partProperty(i, "life", 10)
  225.     end
  226. end
  227.  
  228. elem.property(piranha, "Update", swimming)
  229.  
  230. local function trapping(i, x, y, s, nt)
  231.     if sim.partProperty(i, "tmp") == 1 then
  232.         local ctype = sim.partProperty(i, "ctype")
  233.         for r in sim.neighbors(x, y, 2, 2) do
  234.             rtype = sim.partProperty(r, "type")
  235.             if rtype == rat and ctype == rat then
  236.                 sim.partProperty(r, "life", sim.partProperty(r, "life")-math.random(1, 25))
  237.                 sim.partChangeType(i, floor)
  238.                 sim.partProperty(i, "life", 10)
  239.             elseif (rtype == warrior or rtype == cleric or rtype == zombie) and ctype == 0 then
  240.                 sim.partProperty(r, "life", sim.partProperty(r, "life")-math.random(1, 75))
  241.                 sim.partChangeType(i, floor)
  242.                 sim.partProperty(i, "life", 10)
  243.             elseif rtype == floor then
  244.                 if ctype == acid then
  245.                     sim.partChangeType(r, acid)
  246.                 else
  247.                     sim.partProperty(r, "tmp2", 1)
  248.                 end
  249.                 sim.partProperty(r, "life", 10)
  250.             end
  251.         end
  252.     end
  253. end
  254.  
  255. elem.property(trap, "Update", trapping)
  256.  
  257. local function floorlook(i, r, g, b)
  258.     if sim.partProperty(i, "tmp2") == 1 then
  259.         return 0, ren.PMODE_FLAT, 255, 51, 51, 51, 255, 0, 0, 0
  260.     end
  261. end
  262.  
  263. elem.property(floor, "Graphics", floorlook)
  264.  
  265. local function acidity(i, x, y, s, nt)
  266.     local r = sim.partID(x+math.random(-1, 1), y+math.random(-1, 1))
  267.     if r ~= nil then
  268.         local rtype = sim.partProperty(r, "type")
  269.         if rtype == floor then
  270.             sim.partProperty(r, "tmp2", 1)
  271.         end
  272.     end
  273. end
  274.  
  275. elem.property(acid, "Update", acidity)
  276.  
  277. local function moaning(i, x, y, s, nt)
  278.     if sim.partProperty(i, "pavg0") == 0 then
  279.         sim.partProperty(i, "life", 50)
  280.         sim.partProperty(i, "ctype", floor)
  281.         sim.partProperty(i, "pavg0", 1)
  282.     end
  283.     local r = sim.partID(x+math.random(-1, 1), y+math.random(-1, 1))
  284.     if r ~= nil then
  285.         local rtype = sim.partProperty(r, "type")
  286.         if (rtype == floor or rtype == mud or rtype == acid) and sim.partProperty(r, "life") == 0 and math.random(1, 5) == 1 then
  287.             local life = sim.partProperty(i, "life")
  288.             sim.partChangeType(i, sim.partProperty(i, "ctype"))
  289.             sim.partProperty(i, "life", 10)
  290.             sim.partChangeType(r, zombie)
  291.             sim.partProperty(r, "ctype", rtype)
  292.             sim.partProperty(r, "life", life)
  293.             sim.partProperty(i, "ctype", 0)
  294.             sim.partProperty(r, "pavg0", 1)
  295.             return 1
  296.         elseif (rtype == warrior or rtype == cleric or rtype == rat) and math.random(0, 1) == 1 then
  297.             if math.random(1, 50) == 1 then
  298.                 sim.partProperty(r, "type", zombie)
  299.                 sim.partProperty(i, "life", sim.partProperty(i, "life")+1)
  300.             else
  301.                 sim.partProperty(r, "life", sim.partProperty(r, "life")-math.random(1, 3))
  302.                 sim.partProperty(i, "life", sim.partProperty(i, "life")+1)
  303.             end
  304.         elseif rtype == trap and sim.partProperty(r, "ctype") ~= rat then
  305.             sim.partProperty(r, "tmp", 1)
  306.         end
  307.     end
  308.     if math.random(1, 50) == 1 and sim.partProperty(i, "life") > 0 then
  309.         sim.partProperty(i, "life", sim.partProperty(i, "life")-1)
  310.     end
  311.     if sim.partProperty(i, "life") <= 0 then
  312.         sim.partChangeType(i, sim.partProperty(i, "ctype"))
  313.         sim.partProperty(i, "life", 10)
  314.         return 1
  315.     end
  316.     if sim.partProperty(i, "ctype") == acid or (sim.partProperty(i, "ctype") == mud and math.random(1, 5) == 1) then
  317.         sim.partProperty(i, "life", sim.partProperty(i, "life")-math.random(1, 2))
  318.     end
  319. end
  320.  
  321. elem.property(zombie, "Update", moaning)
  322.  
  323. local function tiling(i, x, y, s, nt)
  324.     local ctype = sim.partProperty(i, "ctype")
  325.     if ctype ~= 0 then
  326.         if ctype == warrior then
  327.             sim.partKill(i)
  328.             sim.partCreate(-1, x, y, warrior)
  329.         elseif ctype == rat then
  330.             sim.partKill(i)
  331.             sim.partCreate(-1, x, y, rat)
  332.         elseif ctype == mud then
  333.             sim.partKill(i)
  334.             sim.partCreate(-1, x, y, mud)
  335.         elseif ctype == acid then
  336.             sim.partKill(i)
  337.             sim.partCreate(-1, x, y, acid)
  338.         elseif ctype == piranha then
  339.             sim.partKill(i)
  340.             sim.partCreate(-1, x, y, piranha)
  341.         elseif ctype == zombie then
  342.             sim.partKill(i)
  343.             sim.partCreate(-1, x, y, zombie)
  344.         elseif ctype == trap then
  345.             sim.partKill(i)
  346.             sim.partCreate(-1, x, y, trap)
  347.         elseif ctype == cleric then
  348.             sim.partKill(i)
  349.             sim.partCreate(-1, x, y, cleric)
  350.         elseif ctype == firebolt then
  351.             sim.partKill(i)
  352.             sim.partCreate(-1, x, y, firebolt)
  353.         end
  354.     end
  355. end
  356.  
  357. elem.property(floor, "Update", tiling)
  358.  
  359. local function burning(i, x, y, s, nt)
  360.     sim.partProperty(i, "life", sim.partProperty(i, "life")-1)
  361.     local r = sim.partID(x+math.random(-1, 1), y+math.random(-1, 1))
  362.     if r ~= nil then
  363.         local rtype = sim.partProperty(r, "type")
  364.         if (rtype == warrior or rtype == cleric or rtype == rat or rtype == zombie) and sim.partProperty(i, "pavg0") == 0 then
  365.             sim.partProperty(i, "pavg0", 1)
  366.             sim.partProperty(i, "life", 2000)
  367.         elseif rtype == firebolt and sim.partProperty(r, "pavg0") == 1 and sim.partProperty(i, "pavg0") == 0 then
  368.             sim.partProperty(i, "pavg0", 1)
  369.             sim.partProperty(i, "life", 2000)
  370.         end
  371.     end
  372.     if sim.partProperty(i, "life") == 0 and sim.partProperty(i, "pavg0") == 1 then
  373.         for r in sim.neighbors(x, y, 5, 5) do
  374.             local rtype = sim.partProperty(r, "type")
  375.             if rtype == firebolt and sim.partProperty(r, "pavg0") == 1 then
  376.                 sim.partProperty(r, "life", 10)
  377.             elseif rtype == warrior or rtype == cleric or rtype == rat or rtype == zombie or rtype == piranha then
  378.                 sim.partProperty(r, "life", 0)
  379.             elseif rtype == mud or rtype == acid then
  380.                 sim.partChangeType(r, floor)
  381.                 sim.partProperty(r, "tmp2", 1)
  382.             elseif rtype == floor then
  383.                 sim.partProperty(r, "tmp2", 1)
  384.             elseif rtype == trap then
  385.                 sim.partProperty(r, "tmp", 1)
  386.             end
  387.         end
  388.         sim.partKill(i)
  389.         local left = sim.partCreate(-1, x, y, floor)
  390.         sim.partProperty(r, "tmp2", 1)
  391.         return 1
  392.     end
  393. end
  394.  
  395. elem.property(firebolt, "Update", burning)
  396.  
  397. local function boltGlow(i, r, g, b)
  398.     local rand = math.random(1, 3)
  399.     if sim.partProperty(i, "pavg0") == 0 then
  400.         if rand == 1 then
  401.             return 0, ren.PMODE_FLAT, 255, 255, 0, 0, 0, 0, 0, 0
  402.         elseif rand == 2 then
  403.             return 0, ren.PMODE_FLAT+ren.PMODE_FLARE, 255, 255, 51, 0, 0, 0, 0, 0
  404.         else
  405.             return 0, ren.PMODE_FLAT, 255, 255, 102, 0, 0, 0, 0, 0
  406.         end
  407.     else
  408.         if sim.partProperty(i, "life") >= 500 then
  409.             if rand == 1 then
  410.                 return 0, ren.PMODE_FLAT+ren.PMODE_FLARE, 255, 255, 0, 0, 0, 0, 0, 0
  411.             elseif rand == 2 then
  412.                 return 0, ren.PMODE_FLAT+ren.PMODE_LFLARE, 255, 255, 51, 0, 0, 0, 0, 0
  413.             else
  414.                 return 0, ren.PMODE_FLAT+ren.PMODE_FLARE, 255, 255, 102, 0, 0, 0, 0, 0
  415.             end
  416.         else
  417.             if rand == 1 then
  418.                 return 0, ren.PMODE_FLAT+ren.PMODE_LFLARE, 255, 255, 0, 0, 0, 0, 0, 0
  419.             elseif rand == 2 then
  420.                 return 0, ren.PMODE_FLAT+ren.PMODE_LFLARE, 255, 255, 51, 0, 0, 0, 0, 0
  421.             else
  422.                 return 0, ren.PMODE_FLAT+ren.PMODE_LFLARE, 255, 255, 102, 0, 0, 0, 0, 0
  423.             end
  424.         end
  425.     end
  426. end
  427.  
  428. elem.property(firebolt, "Graphics", boltGlow)
  429.  
  430. -- Button code VVV
  431.  
  432. elem.property(warrior, "MenuVisible", 0)
  433. elem.property(cleric, "MenuVisible", 0)
  434. elem.property(rat, "MenuVisible", 0)
  435. elem.property(zombie, "MenuVisible", 0)
  436. elem.property(piranha, "MenuVisible", 0)
  437. elem.property(floor, "MenuVisible", 0)
  438. elem.property(mud, "MenuVisible", 0)
  439. elem.property(acid, "MenuVisible", 0)
  440. elem.property(trap, "MenuVisible", 0)
  441. elem.property(firebolt, "MenuVisible", 0)
  442.  
  443. local spritetab = elem.allocate("EXOTIC", "BSPRITE")
  444.  
  445. elem.element(spritetab, elem.element(elem.DEFAULT_PT_DUST))
  446. elem.property(spritetab, "Name", "SPRT")
  447. elem.property(spritetab, "Description", "Click to open the 'Sprites' tab.")
  448. elem.property(spritetab, "MenuSection", elem.SC_SPECIAL)
  449. elem.property(spritetab, "Properties", elem.PROP_LIFE_DEC+elem.PROP_LIFE_KILL)
  450.  
  451. local tiletab = elem.allocate("EXOTIC", "BENEMY")
  452.  
  453. elem.element(tiletab, elem.element(elem.DEFAULT_PT_DUST))
  454. elem.property(tiletab, "Name", "TILE")
  455. elem.property(tiletab, "Description", "Click to open the 'Tiles' tab.")
  456. elem.property(tiletab, "MenuSection", elem.SC_SPECIAL)
  457. elem.property(tiletab, "Properties", elem.PROP_LIFE_DEC+elem.PROP_LIFE_KILL)
  458.  
  459. elem.element(backtab, elem.element(elem.DEFAULT_PT_DUST))
  460. elem.property(backtab, "Name", "BACK")
  461. elem.property(backtab, "Description", "Click to go back to the normal menu.")
  462. elem.property(backtab, "MenuSection", elem.SC_SPECIAL)
  463. elem.property(backtab, "MenuVisible", 0)
  464. elem.property(backtab, "Properties", elem.PROP_LIFE_DEC+elem.PROP_LIFE_KILL)
  465.  
  466. local special = {}
  467. for i = 1, 255 do
  468.     pcall(function()
  469.         if elem.property(i, "MenuVisible") == 1 and elem.property(i, "MenuSection") == elem.SC_SPECIAL then
  470.             special[i] = true
  471.         end
  472.     end)
  473. end
  474.  
  475. local function switch(n)
  476.     if n == 1 then
  477.         elem.property(warrior, "MenuVisible", 1)
  478.         elem.property(cleric, "MenuVisible", 1)
  479.         elem.property(rat, "MenuVisible", 1)
  480.         elem.property(zombie, "MenuVisible", 1)
  481.         elem.property(piranha, "MenuVisible", 1)
  482.         elem.property(floor, "MenuVisible", 0)
  483.         elem.property(mud, "MenuVisible", 0)
  484.         elem.property(acid, "MenuVisible", 0)
  485.         elem.property(trap, "MenuVisible", 0)
  486.         elem.property(firebolt, "MenuVisible", 0)
  487.         elem.property(spritetab, "MenuVisible", 0)
  488.         elem.property(tiletab, "MenuVisible", 0)
  489.         for i in pairs(special) do
  490.             elem.property(i, "MenuVisible", 0)
  491.         end
  492.         elem.property(backtab, "MenuVisible", 1)
  493.     elseif n == 2 then
  494.         elem.property(warrior, "MenuVisible", 0)
  495.         elem.property(cleric, "MenuVisible", 0)
  496.         elem.property(rat, "MenuVisible", 0)
  497.         elem.property(zombie, "MenuVisible", 0)
  498.         elem.property(piranha, "MenuVisible", 0)
  499.         elem.property(floor, "MenuVisible", 1)
  500.         elem.property(mud, "MenuVisible", 1)
  501.         elem.property(acid, "MenuVisible", 1)
  502.         elem.property(trap, "MenuVisible", 1)
  503.         elem.property(firebolt, "MenuVisible", 1)
  504.         elem.property(spritetab, "MenuVisible", 0)
  505.         elem.property(tiletab, "MenuVisible", 0)
  506.         for i in pairs(special) do
  507.             elem.property(i, "MenuVisible", 0)
  508.         end
  509.         elem.property(backtab, "MenuVisible", 1)
  510.     elseif n == 0 then
  511.         elem.property(warrior, "MenuVisible", 0)
  512.         elem.property(cleric, "MenuVisible", 0)
  513.         elem.property(rat, "MenuVisible", 0)
  514.         elem.property(zombie, "MenuVisible", 0)
  515.         elem.property(piranha, "MenuVisible", 0)
  516.         elem.property(floor, "MenuVisible", 0)
  517.         elem.property(mud, "MenuVisible", 0)
  518.         elem.property(acid, "MenuVisible", 0)
  519.         elem.property(trap, "MenuVisible", 0)
  520.         elem.property(firebolt, "MenuVisible", 0)
  521.         elem.property(backtab, "MenuVisible", 0)
  522.         for i in pairs(special) do
  523.             elem.property(i, "MenuVisible", 1)
  524.         end
  525.         elem.property(spritetab, "MenuVisible", 1)
  526.         elem.property(tiletab, "MenuVisible", 1)
  527.     end
  528. end
  529.  
  530. local function buttons()
  531.     if tpt.selectedl == elem.property(spritetab, "Identifier") then
  532.         switch(1)
  533.         tpt.selectedl = "MAZE_PT_WARR"
  534.     elseif tpt.selectedl == elem.property(tiletab, "Identifier") then
  535.         switch(2)
  536.         tpt.selectedl = "MAZE_PT_FLOOR"
  537.     elseif tpt.selectedl == elem.property(backtab, "Identifier") then
  538.         switch(0)
  539.         tpt.selectedl = "DEFAULT_PT_TRON"
  540.     end
  541. end
  542. tpt.register_step(buttons)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement