Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Light string
- @inputs End:entity
- @persist Max:number ModelKabel:string ModelKugel:string LightMode:number Alpha:number Direction:number
- @persist LightBrightness:number LightDistance:number LightColor:vector
- @persist Pitch:number DirectionOfHanging:number
- @persist MaterialKable:string MaterialKugel:string
- @model models/hunter/blocks/cube025x025x025.mdl
- runOnTick(1)
- runOnLast(1)
- E=entity()
- if(first()) {
- E = entity()
- E:setAlpha(0)
- LightMode = 2 #Light Mode 1 = RGB | Mode 2 = Color from LightColor settings | Mode 3 = Random Color
- LightColor = vec(0,150,255) #Light Color ist fur Mode 2 die Farbe
- MaterialKable = "debug/debugdrawflat" #Matrial for cable
- MaterialKugel = "debug/debugdrawflat" #Matrial for ball's
- Max = 15 #Ball number
- Direction = 0.5 #Hang direction 0.5 is the middle
- DirectionOfHanging = 0 #Hang direction left or right
- Pitch = 5 #How the cable hangs
- ModelKabel = "cube" #Cable model
- ModelKugel = "hq_sphere" #Ball model
- Alpha = 255 #Model Alpha
- LightBrightness = 1 #Light brightness
- LightDistance = 1 #Light distance
- RandomeColor = vec(random(1,255),random(1,255),random(1,255)) #Create Randome colors
- for(I=0,Max) { holoCreate(I) holoPos(I,E:pos()+vec(0,0,13*I)) Tar=E if(I>1) { Tar=holoEntity(I-1) } holoModel(I, ModelKugel) holoMaterial(I, MaterialKugel) holoScaleUnits(I, vec(6)) holoAlpha(I, Alpha) holoDisableShading(I, 1)
- if(LightMode==1){
- holoColor(I, hsv2rgb(I*10, 1, 1))
- }elseif(LightMode==2){
- holoColor(I, LightColor)
- }elseif(LightMode==3){
- holoColor(I,RandomeColor)
- }
- }
- for(I=0+100,Max+100) { holoCreate(I) holoPos(I,E:pos()+vec(0,0,13*I)) Tar=E if(I>1) { Tar=holoEntity(I-1) } holoModel(I, ModelKabel) holoMaterial(I, MaterialKable) holoScaleUnits(I, vec(6)) holoColor(I, vec(0)) holoAlpha(I, 255) holoDisableShading(I, 1) }
- #Check if LightCore is on the server
- #ifdef lightCreate(number,vector)
- for(A=0,Max) { lightCreate(A) lightPos(A,E:pos()+vec(0,0,13*A)) Tar=E if(A>1) { Tar=lightEntity(A-1) } lightBrightness(A, LightBrightness) lightDistance(A, LightDistance)
- if(LightMode==1){
- lightColor(A,hsv2rgb(A*10, 1, 1))
- }elseif(LightMode==2){
- lightColor(A,LightColor)
- }elseif(LightMode==3){
- lightColor(A,RandomeColor)
- }
- }
- #endif
- function vector makeRope(Start:vector,End:vector,Amount:number,Index:number) {
- local SplitDist = Start:distance(End)/Amount
- local Split = 1/Amount
- return bezier(Start,mix(End,Start,Direction)-vec(0,DirectionOfHanging,((Start-End):length())/Pitch),End,Split*Index)
- }
- function void makeHoloRope(Index:number,IndexR:number,Dis:number) {
- E1=entity() if(IndexR>0) { E1=holoEntity(IndexR-1) }
- E2=End if(IndexR<Max) { E2=holoEntity(IndexR) }
- holoPos(Index,E1:pos()+(E2:pos()-E1:pos())/2)
- holoScaleUnits(Index,vec(2,2,E1:pos():distance(E2:pos())))
- holoAng(Index,(E1:pos()-E2:pos()):toAngle()+ang(90,0,0))
- }
- }
- function setupProp(Parent:entity){
- if(!End){
- findByModel("models/hunter/blocks/cube025x025x025.mdl")
- findSortByDistance(entity():pos())
- if(find():owner()==owner()){
- End = find()
- }
- }else{
- if(!End:parent()){
- if(End){
- if(clk("load")){
- End:parentTo(Parent)
- End:setAlpha(0)
- }
- }
- }
- }
- }
- if(perf(1)){
- setupProp(E)
- }
- if(End&perf(10)) {
- End:setAlpha(0)
- for(A=0,Max){
- local Dis = E:pos():distance(End:pos())/Max
- #Check if LightCore is on the server
- #ifdef lightCreate(number,vector)
- lightPos(A,makeRope(E:pos(),End:pos(),Max,A))
- #endif
- makeHoloRope(A+100,A,Dis)
- }
- for(I=0,Max) {
- local Dis = E:pos():distance(End:pos())/Max
- holoPos(I,makeRope(E:pos(),End:pos(),Max,I))
- makeHoloRope(I+100,I,Dis)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement