Advertisement
Matera_the_Mad

tpt_langtons_ent.lua

Jan 20th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.11 KB | None | 0 0
  1. -- Langton's Ant W.I.P. by DayTimer253
  2. -- Modified by Matera_the_Mad just for shiggles
  3. siden = 1
  4. side = 1
  5. local ENT = elements.allocate("DLI", "ENT")
  6. elements.element(ENT, elements.element(elements.DEFAULT_PT_PROT))
  7. elements.property(ENT, "Name" , "ENT")
  8. elements.property(ENT, "Description" , "Default Langton's ENT. Changes elements above it to air, rotates 90* and moves forward, else rotates -90* and changes air to GOO, BCLN, WOOD, or VINE. DO NOT PLACE MORE THAN 1!")
  9. elements.property(ENT, "Color", 0x99FF66)
  10. elements.property(ENT, "Diffusion", 0)
  11. elements.property(ENT, "Weight", 0)
  12. elements.property(ENT, "MenuSection", 12)
  13. elements.property(elements.DLI_PT_ENT, "Update",
  14. function(i,x,y,s,nt)
  15.     siden = side
  16.     sim.partProperty(i, "y", y-1) --to test particles under it
  17.     sim.partProperty(i, "x", x-1)
  18.     if siden == 4 then
  19.         local px,py = 0,0
  20.         px,py = x, y
  21.         if sim.partID(px,py) == 0 then
  22.             tpt.create(px,py,"VINE")
  23.             sim.partProperty(i, "x", px+1)-- +
  24.             side=1
  25.         else
  26.             sim.partKill(sim.partID(px,py))
  27.             side=3
  28.             sim.partProperty(i, "x", px-1)-- -
  29.         end end
  30.             if siden == 3 then
  31.                 local px,py = 0,0
  32.                 px,py = x, y
  33.                 if sim.partID(px,py) == 0 then
  34.                     tpt.create(px,py,"WOOD")
  35.                     sim.partProperty(i, "y", py+1)
  36.                     side=4
  37.                 else
  38.                     sim.partKill(sim.partID(px,py))
  39.                     side=2
  40.                     sim.partProperty(i, "y", py-1)
  41.                 end end
  42.                     if siden == 2 then
  43.                         local px,py = 0,0
  44.                         px,py = x, y
  45.                         if sim.partID(px,py) == 0 then
  46.                             tpt.create(px,py,"BCLN")
  47.                             sim.partProperty(i, "x", px-1)-- -
  48.                             side=3
  49.                         else
  50.                             sim.partKill(sim.partID(px,py))
  51.                             side=1
  52.                             sim.partProperty(i, "x", px+1)-- +
  53.                         end end
  54.                             if siden == 1 then
  55.                                 local px,py = 0,0
  56.                                 px,py = x, y
  57.                                 if sim.partID(px,py) == 0 then
  58.                                     tpt.create(px,py,"GOO")
  59.                                     sim.partProperty(i, "y", py-1)
  60.                                     side=2
  61.                                 else
  62.                                     sim.partKill(sim.partID(px,py))
  63.                                     side=4
  64.                                     sim.partProperty(i, "y", py+1)
  65.                                 end
  66. sim.partProperty(i,"y", y+1) --testing particle under it
  67.     sim.partProperty(i, "x", x+1)
  68.     end
  69. end
  70. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement