DanielGalrito

TPT AND Gate Generator

Mar 8th, 2015
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. Andg = elements.allocate("Andg", "ANDG")
  2. elements.element(Andg, elements.element(elements.DEFAULT_PT_DMND))
  3. elements.property(Andg, "Name", "ANDG")
  4. elements.property(Andg, "Description", "AND gate generator, tmp sets input direction.")
  5. elements.property(Andg, "Properties", 0x0004)
  6.  
  7.  
  8. local function Andg(i,x,y,s,nt)
  9. --tmp = 0 = input left
  10. --tmp = 1 = input top
  11. --tmp = 2 = input right
  12. --tmp = 3 = input below
  13. if tpt.get_property("tmp", i) == 0 then
  14. tpt.create(x-1, y-2,"metl")
  15. tpt.create(x-1, y+2,"pscn")
  16. tpt.create(x+2, y+0,"pscn")
  17. tpt.set_property("type","ntct",i)
  18. end
  19.  
  20. if tpt.get_property("tmp", i) == 1 then
  21. tpt.create(x+2, y-1,"metl")
  22. tpt.create(x-2, y-1,"pscn")
  23. tpt.create(x+0, y+2,"pscn")
  24. tpt.set_property("type","ntct",i)
  25. end
  26.  
  27. if tpt.get_property("tmp", i) == 2 then
  28. tpt.create(x+1, y+2,"metl")
  29. tpt.create(x+1, y-2,"pscn")
  30. tpt.create(x-2, y+0,"pscn")
  31. tpt.set_property("type","ntct",i)
  32. end
  33.  
  34. if tpt.get_property("tmp", i) == 3 then
  35. tpt.create(x-2, y+1,"metl")
  36. tpt.create(x+2, y+1,"pscn")
  37. tpt.create(x+0, y-2,"pscn")
  38. tpt.set_property("type","ntct",i)
  39. end
  40. end
  41. tpt.element_func(Andg, tpt.element('andg'))
Advertisement
Add Comment
Please, Sign In to add comment