Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name PukaScan
- @inputs DS:wirelink Sun:entity
- @outputs
- @persist Res WindowRes WindowDist MaxDist CalColor:vector Running E:entity AtX AtY
- @trigger
- if(first())
- {
- runOnTick(1)
- Res = 128
- WindowRes = 64
- WindowDist = 64
- MaxDist = 2000
- CalColor = vec(255,255,255) / MaxDist
- Running = 1
- E = entity()
- rangerPersist(1)
- rangerFilter(E)
- rangerFilter(Sun)
- holoCreate(1)
- holoScale(1, vec(1,1,1) * 0.3)
- DS[1048572] = Res
- DS[1048573] = Res
- }
- if(Running)
- {
- while(perf())
- {
- WindowPos = E:pos() + E:right()*(-WindowRes/2 + (WindowRes/Res)*AtX) + E:forward()*(-WindowRes/2 + (WindowRes/Res)*AtY) + E:up()*WindowDist
- R = rangerOffset(MaxDist, E:pos(), (WindowPos - E:pos()):normalized())
- holoPos(1, WindowPos)
- AtX++
- if(AtX >= Res)
- {
- AtX = 0
- AtY++
- }
- if(AtY >= Res)
- {
- Running = 0
- }
- #print("X: "+AtX + " Y: "+AtY)
- #print("Dist: "+R:distance())
- Color = CalColor * (MaxDist-R:distance())
- #Color = R:hitNormal() * vec(255,255,255)
- Dir = Sun:pos() - R:pos()
- SunRay = rangerOffset(Dir:length(), R:pos(), Dir:normalized())
- if(SunRay:hit())
- {
- Color -= vec(1,1,1) * 100
- }
- Cell = AtX*Res + (Res-AtY)
- DS[Cell] = rgb2digi(Color,0)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement