Advertisement
LBPHacker

FILT circuitry colorizer

Dec 15th, 2015
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. local filtcolorlookup = {
  2.     [0] = 0xFFFFFFFF, -- set, white
  3.     [1] = 0xFFFF0000, -- AND, red
  4.     [2] = 0xFF00FF00, -- OR, green
  5.     [3] = 0xFFFF7F3F, -- subtract, orange-ish
  6.     [4] = 0xFFFFFF00, -- red shift, yellow
  7.     [5] = 0xFF00FFFF, -- blue shift, cyan
  8.     [7] = 0xFFFF00FF, -- xor, pink
  9. }
  10. for partID in sim.parts() do
  11.     local ptype = sim.partProperty(partID, "type")
  12.     if ptype ~= elem.DEFAULT_PT_DMND then
  13.         sim.partProperty(partID, "dcolour", (ptype == elem.DEFAULT_PT_FILT and filtcolorlookup[sim.partProperty(partID, "tmp")]) or 0xFF3F3F3F)
  14.     end
  15. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement