Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name RDC Dipping Sonar V1.0
- @inputs ToggleDeploy Seat:entity Active
- @outputs TPos:vector Deploying TDepth
- @persist Deploying Deploy SEnt:entity I Tube1 Tube2 Tube3 Tube4 Tube5 Height Sonar FOV Base UWater Tracker Ents:array
- @trigger
- interval(100)
- if(duped()|dupefinished())
- {
- reset()
- }
- elseif(first())
- {
- CamOffset=vec(0,0,2.5)
- MainColor=vec(230,230,230)
- RopeColor=vec(55)
- MainMat="sprops/textures/sprops_cfiber1"
- I=1
- Base=I
- holoCreate(I) #CIWS stand left
- holoPos(I, entity():toWorld(vec(0,0,0)))
- holoAng(I, entity():toWorld(ang(0)))
- holoAlpha(I,0)
- holoParent(I,entity())
- I++
- Tube1=I
- holoCreate(I) #CIWS stand left
- holoPos(I, holoEntity(Base):toWorld(vec(0,0,-4)))
- holoAng(I, holoEntity(Base):toWorld(ang(0)))
- holoScale(I, vec(0.05,0.05,2))
- holoColor(I,RopeColor)
- holoModel(I, "hq_cylinder")
- holoMaterial(I,MainMat)
- holoParent(I,holoEntity(Base))
- I++
- Tube2=I
- holoCreate(I) #CIWS stand left
- holoPos(I, holoEntity(Tube1):toWorld(vec(0,0,0)))
- holoAng(I, entity():toWorld(ang(0)))
- holoScale(I, vec(0.05,0.05,2))
- holoColor(I,RopeColor)
- holoModel(I, "hq_cylinder")
- holoMaterial(I,MainMat)
- holoParent(I,holoEntity(Tube1))
- I++
- Tube3=I
- holoCreate(I) #CIWS stand left
- holoPos(I, holoEntity(Tube2):toWorld(vec(0,0,0)))
- holoAng(I, entity():toWorld(ang(0)))
- holoScale(I, vec(0.05,0.05,2))
- holoColor(I,RopeColor)
- holoModel(I, "hq_cylinder")
- holoMaterial(I,MainMat)
- holoParent(I,holoEntity(Tube2))
- I++
- Tube4=I
- holoCreate(I) #CIWS stand left
- holoPos(I, holoEntity(Tube3):toWorld(vec(0,0,0)))
- holoAng(I, entity():toWorld(ang(0)))
- holoScale(I, vec(0.05,0.05,2))
- holoColor(I,RopeColor)
- holoModel(I, "hq_cylinder")
- holoMaterial(I,MainMat)
- holoParent(I,holoEntity(Tube3))
- I++
- Tube5=I
- holoCreate(I) #CIWS stand left
- holoPos(I, holoEntity(Tube4):toWorld(vec(0,0,0)))
- holoAng(I, entity():toWorld(ang(0)))
- holoScale(I, vec(0.05,0.05,2))
- holoColor(I,RopeColor)
- holoModel(I, "hq_cylinder")
- holoMaterial(I,MainMat)
- holoParent(I,holoEntity(Tube4))
- I++
- Sonar=I
- SEnt=holoCreate(I) #CIWS stand left
- holoPos(I, holoEntity(Tube5):toWorld(vec(0,0,-20)))
- holoAng(I, entity():toWorld(ang(0)))
- holoScale(I, vec(0.4))
- holoColor(I,MainColor)
- holoModel(I, "models/props_junk/propane_tank001a.mdl")
- holoMaterial(I,MainMat)
- holoParent(I,holoEntity(Tube5))
- I++
- Tracker=I
- holoCreate(I) #Base
- holoPos(I, vec(0))
- # holoAng(I, entity():toWorld(ang(0,0,0)))
- holoScale(I, vec(1,1,50))
- holoModel(I,"models/sprops/cylinders/size_5/cylinder_12x480.mdl")
- holoAlpha(I,100)
- holoColor(I,vec(255,0,0))
- # holoParent(I,entity())
- I++
- holoAlpha(Tube1,0)
- holoAlpha(Tube2,0)
- holoAlpha(Tube3,0)
- holoAlpha(Tube4,0)
- holoAlpha(Tube5,0)
- holoVisible(Tracker,players(),0)
- function adjustMastHeight(InHeight)
- {
- holoPos(Tube1, holoEntity(Base):toWorld(vec(0,0,-InHeight-8)))
- holoPos(Tube2, holoEntity(Tube1):toWorld(vec(0,0,-InHeight-8)))
- holoPos(Tube3, holoEntity(Tube2):toWorld(vec(0,0,-InHeight-8)))
- holoPos(Tube4, holoEntity(Tube3):toWorld(vec(0,0,-InHeight-8)))
- holoPos(Tube5, holoEntity(Tube4):toWorld(vec(0,0,-InHeight-8)))
- }
- Height=-13
- adjustMastHeight(Height)
- # rangerPersist(1)
- # rangerIgnoreWorld(1)
- }
- if(ToggleDeploy&~ToggleDeploy)
- {
- Deploy=!Deploy
- Deploying=1
- if(Deploy)
- {
- soundStop("MovingSound")
- entity():soundPlay("MovingSound",0,"acf_extra/airfx/gear_up.wav")
- soundPitch("MovingSound",150)
- }
- else
- {
- soundStop("MovingSound")
- entity():soundPlay("MovingSound",0,"acf_extra/airfx/gear_up.wav")
- soundPitch("MovingSound",80)
- }
- }
- if(Deploying&Deploy) #Deploy
- {
- Height=clamp(Height+0.75,-13,4)
- adjustMastHeight(Height)
- if(Height==4)
- {
- Deploying=0
- soundStop("MovingSound")
- entity():soundPlay("Latch",0,"acf_extra/airfx/weapon_select.wav")
- soundPitch("Latch",80)
- }
- if(Height>=-8)
- {
- holoAlpha(Tube1,255)
- holoAlpha(Tube2,255)
- holoAlpha(Tube3,255)
- holoAlpha(Tube4,255)
- holoAlpha(Tube5,255)
- }
- }
- elseif(Deploying&!Deploy) #Retract
- {
- Height=clamp(Height-0.5,-13,4)
- adjustMastHeight(Height)
- if(Height==-13)
- {
- Deploying=0
- soundStop("MovingSound")
- entity():soundPlay("Latch",0,"acf_extra/airfx/TOW_reload.wav")
- soundPitch("Latch",80)
- }
- if(Height<=-9)
- {
- holoAlpha(Tube1,0)
- holoAlpha(Tube2,0)
- holoAlpha(Tube3,0)
- holoAlpha(Tube4,0)
- holoAlpha(Tube5,0)
- }
- }
- holoAng(Base,ang(0))
- UWater=SEnt:isUnderWater()
- if(~Active&Active)
- {
- holoVisible(Tracker,players(),0)
- holoVisible(Tracker,Seat:driver(),1)
- }
- if(changed(UWater))
- {
- stoptimer("SonarPulse")
- timer("SonarPulse",500)
- }
- if(SEnt:isUnderWater())
- {
- if(clk("SonarPulse"))
- {
- soundStop("Pulse")
- entity():soundPlay("Pulse",1.5,"npc/scanner/combat_scan4.wav")
- soundPitch("Pulse",150) #Dip Pitch
- #soundPitch("Pulse",125) #Ship Pitch
- #rangerOffsetHull(Mine:toWorld(vec(0,0,74)),Mine:toWorld(vec(0,0,80)),vec(70))
- findIncludeClass("prop_physics")
- findInBox(SEnt:toWorld(vec(-2000)),SEnt:toWorld(vec(2000,2000,0)))
- TEnt=findClosest(SEnt:pos())
- rangerIgnoreWorld(1)
- if(TEnt:isValid()&entity():vel():length()<40)
- {
- Dist=TEnt:pos():distance(SEnt:pos())
- TPos=SEnt:toWorld(SEnt:toLocal(TEnt:pos())*vec(1+random(-1,1)*Dist/4500,1+random(-1,1)*Dist/4500,1+random(-1,1)*Dist/8000))
- TVel=TEnt:vel()*vec(1+random(-1,1)*Dist/8000,1+random(-1,1)*Dist/8000,1+random(-1,1)*Dist/8000)
- TDepth=(SEnt:pos():z()-TPos:z())
- soundStop("Echo")
- TEnt:soundPlay("Echo",1,"npc/scanner/combat_scan4.wav")
- soundPitch("Echo",110) #Dip Pitch
- holoPos(Tracker,TPos)
- }
- timer("SonarPulse",3000)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement