Advertisement
RCAProduction

woodRewrite.lua

Sep 29th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. --INIT
  2. maxT=400
  3.  
  4. --Scale Factor, 1 = no scale
  5. adjustVal=5
  6.  
  7. --Range loop, finds range of TMPs on the screen from 400
  8. for i in sim.parts(i) do
  9.     if sim.partProperty(i,"type")==17 and sim.partProperty(i,"tmp")>maxT then
  10.         maxT=sim.partProperty(i,"tmp")
  11.     end
  12. end
  13.  
  14. --Range calculations
  15. range=(maxT-400)*adjustVal
  16. dsize=range/254
  17.  
  18. --Set dcolour
  19. for i in sim.parts(i) do
  20.     if sim.partProperty(i,"type")==17 then
  21.         if sim.partProperty(i,"tmp")<=0 then
  22.             color=0xFFFFFFFF
  23.         else
  24.             color=0xFF000000+((0x00010101)*(255-(math.floor((sim.partProperty(i,"tmp")-400)/dsize))))
  25.  
  26.         end
  27.  
  28.         sim.partProperty(i, "dcolour", color)
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement