@name APC A2800
@inputs [W,A,S,D,Shift,Alt,Mouse1,Mouse2,Active]:number [Seat]:entity [EGP1,EGP2]:wirelink
@outputs [Dist1]:number 
@persist [Main,Target]:entity [N128,Int]:number [Model]:string
@persist [Mass,Power,Hight,Dumping,AngMul,Max,Speed,Steer,Scale,Rad,Thick,SpeedMul,SteerMul]:number
@persist [ForceMul,VelR,VelL,RollR,RollL]:number
@persist [Mul1,Mul2,Mul3,Mul4,Mul5,Mul6]:number
@persist [Dist1,Dist2,Dist3,Dist4,Dist5,Dist6]:number
@persist [LockOn,Lock,Sel,Ang,First]:number
@persist [Ang11,Ang21,F1]:number
@persist [Ang12,Ang22,F2]:number
@persist [Flip1,Flip2,Flip3]:number
@persist [Open,X,SoundPlay,SUpMul,Powered]:number
@persist [Tick,EnLoad]:number
@persist [Color,ColorO]:vector
@persist [Changed]:table
@model models/hunter/blocks/cube2x4x025.mdl

if(duped()|dupefinished()){reset()}

if(N128<62){

interval(200)

N128=N128+1

if(N128==1){


#Settings

Int=2
Scale=entity():boxSize():y()
Main=holoCreate(0)
Mass=10000
Power=0.2
Hight=70
Dumping=0.12
AngMul=15
Max=70
SpeedMul=5
SteerMul=5
Rad=12/36.087
Thick=7/36.087
First=1
Model="Full"

entity():setMass(Mass)

#EGP-Stuff

Color=vec(180,0,0)
ColorO=vec(15,15,15)
EGP1:egpClear()
EGP1:egpResolution(vec2(0,0),vec2(2000,1000))

Add=47

EGP1:egpBox(1,vec2(175+Add,200),vec2(250,50))
EGP1:egpBox(2,vec2(450+Add,200),vec2(250,50))
EGP1:egpBox(3,vec2(183+Add,260),vec2(240,50))
EGP1:egpBox(4,vec2(445+Add,260),vec2(240,50))
EGP1:egpBox(5,vec2(188+Add,320),vec2(230,50))
EGP1:egpBox(6,vec2(440+Add,320),vec2(230,50))
EGP1:egpBox(7,vec2(190+Add,380),vec2(220,50))
EGP1:egpBox(8,vec2(435+Add,380),vec2(220,50))
EGP1:egpBox(9,vec2(195+Add,440),vec2(210,50))
EGP1:egpBox(10,vec2(430+Add,440),vec2(210,50))
EGP1:egpBox(11,vec2(203+Add,500),vec2(200,50))
EGP1:egpBox(12,vec2(425+Add,500),vec2(200,50))
EGP1:egpBox(13,vec2(208+Add,560),vec2(190,50))
EGP1:egpBox(14,vec2(420+Add,560),vec2(190,50))
EGP1:egpBox(15,vec2(210+Add,620),vec2(180,50))
EGP1:egpBox(16,vec2(415+Add,620),vec2(180,50))
EGP1:egpBox(17,vec2(215+Add,680),vec2(170,50))
EGP1:egpBox(18,vec2(410+Add,680),vec2(170,50))
EGP1:egpBox(19,vec2(223+Add,740),vec2(160,50))
EGP1:egpBox(20,vec2(405+Add,740),vec2(160,50))
EGP1:egpBox(21,vec2(225+Add,800),vec2(150,50))
EGP1:egpBox(22,vec2(400+Add,800),vec2(150,50))
EGP1:egpText(23,"Km/h",vec2(340,40))
EGP1:egpText(24,"999",vec2(20,40))
EGP1:egpBoxOutline(25,vec2(1000,330),vec2(300,300))
EGP1:egpBoxOutline(26,vec2(1000,330),vec2(300,1))
EGP1:egpBoxOutline(27,vec2(1000,800),vec2(300,300))
EGP1:egpBoxOutline(28,vec2(1000,800),vec2(150,150))
EGP1:egpText(29,"Pitch",vec2(850,120))
EGP1:egpText(30,"Orientation",vec2(850,600))
EGP1:egpPolyOutline(31,
vec2(1450,180),
vec2(1850,180),
vec2(1850,230),
vec2(1790,230),
vec2(1790,420),
vec2(1850,420),
vec2(1850,470),
vec2(1790,470),
vec2(1790,660),
vec2(1850,660),
vec2(1850,710),
vec2(1790,710),
vec2(1790,900),
vec2(1850,900),
vec2(1850,950),

vec2(1390,950),
vec2(1390,900),
vec2(1450,900),
vec2(1450,710),
vec2(1390,710),
vec2(1390,660),
vec2(1450,660),
vec2(1450,470),
vec2(1390,470),
vec2(1390,420),
vec2(1450,420),
vec2(1450,230),
vec2(1390,230),
vec2(1390,180)
)

EGP1:egpText(32,"Wheel load",vec2(1340,120))
EGP1:egpBoxOutline(33,vec2(1620,700),vec2(250,380))
EGP1:egpText(34,"Engine load",vec2(1500,450))
EGP1:egpBoxOutline(35,vec2(1380,326),vec2(110,156))
EGP1:egpBoxOutline(36,vec2(1380,566),vec2(110,156))
EGP1:egpBoxOutline(37,vec2(1380,806),vec2(110,156))
EGP1:egpBoxOutline(38,vec2(1860,326),vec2(110,156))
EGP1:egpBoxOutline(39,vec2(1860,566),vec2(110,156))
EGP1:egpBoxOutline(40,vec2(1860,806),vec2(110,156))
EGP1:egpText(41,"N",vec2(1000,700)-vec2(23,23))
EGP1:egpText(42,"E",vec2(1100,800)-vec2(15,23))
EGP1:egpText(43,"S",vec2(1000,900)-vec2(23,23))
EGP1:egpText(44,"W",vec2(900,800)-vec2(33,25))


EGP1:egpFont(23,"default",50)
EGP1:egpFont(24,"default",50)
EGP1:egpFont(29,"default",30)
EGP1:egpFont(30,"default",15)
EGP1:egpFont(32,"default",30)
EGP1:egpFont(34,"default",13)


EGP1:egpSize(25,5)
EGP1:egpSize(26,2)
EGP1:egpSize(27,5)
EGP1:egpSize(28,1)
EGP1:egpSize(31,1)
EGP1:egpSize(33,1)


EGP1:egpColor(1,ColorO*1)
EGP1:egpColor(2,ColorO*1)
EGP1:egpColor(3,ColorO*1)
EGP1:egpColor(4,ColorO*1)
EGP1:egpColor(5,ColorO*1)
EGP1:egpColor(6,ColorO*1)
EGP1:egpColor(7,ColorO*1)
EGP1:egpColor(8,ColorO*1)
EGP1:egpColor(9,ColorO*1)
EGP1:egpColor(10,ColorO*1)
EGP1:egpColor(11,ColorO*1)
EGP1:egpColor(12,ColorO*1)
EGP1:egpColor(13,ColorO*1)
EGP1:egpColor(14,ColorO*1)
EGP1:egpColor(15,ColorO*1)
EGP1:egpColor(16,ColorO*1)
EGP1:egpColor(17,ColorO*1)
EGP1:egpColor(18,ColorO*1)
EGP1:egpColor(19,ColorO*1)
EGP1:egpColor(20,ColorO*1)
EGP1:egpColor(21,ColorO*1)
EGP1:egpColor(22,ColorO*1)
EGP1:egpColor(23,Color*1)

EGP1:egpColor(24,Color*1)
EGP1:egpColor(25,Color*1)
EGP1:egpColor(26,Color*1)
EGP1:egpColor(27,Color*1)
EGP1:egpColor(28,Color*1)
EGP1:egpColor(29,Color*1)
EGP1:egpColor(30,Color*1)
EGP1:egpColor(31,Color*1)
EGP1:egpColor(32,Color*1)
EGP1:egpColor(33,Color*1)
EGP1:egpColor(34,Color*1)
EGP1:egpColor(35,vec(255,0,0))
EGP1:egpColor(36,vec(255,0,0))
EGP1:egpColor(37,vec(255,0,0))
EGP1:egpColor(38,vec(255,0,0))
EGP1:egpColor(39,vec(255,0,0))
EGP1:egpColor(40,vec(255,0,0))


}

if(Model=="None"){if(N128==6){N128=59}}
if(Model=="Engine"){
if(N128==6){N128=25}
if(N128==34){N128=59}
}

}
else{

interval(10*Int)

if(!changed(W+A+S+D+Shift+Alt+Mouse1+Mouse2+Active)){

#Controlls

Speed=SpeedMul*5 Steer=SteerMul*0.8
if(Shift){Speed=SpeedMul*10 Steer=SteerMul*0.5}
if(Alt){Speed=SpeedMul*1.25 Steer=SteerMul*1}

if(Powered==0){W=S=0}


#Hovering

rangerFilter(entity()) Dist1=rangerOffset(Max+10,entity():toWorld(vec( 0.4, 0.5,-0)*Scale),-entity():up()):distance()
rangerFilter(entity()) Dist2=rangerOffset(Max+10,entity():toWorld(vec(-0.4, 0.5,-0)*Scale),-entity():up()):distance()
rangerFilter(entity()) Dist3=rangerOffset(Max+10,entity():toWorld(vec( 0.4, 0.0,-0)*Scale),-entity():up()):distance()
rangerFilter(entity()) Dist4=rangerOffset(Max+10,entity():toWorld(vec(-0.4, 0.0,-0)*Scale),-entity():up()):distance()
rangerFilter(entity()) Dist5=rangerOffset(Max+10,entity():toWorld(vec( 0.4,-0.5,-0)*Scale),-entity():up()):distance()
rangerFilter(entity()) Dist6=rangerOffset(Max+10,entity():toWorld(vec(-0.4,-0.5,-0)*Scale),-entity():up()):distance()
rangerFilter(entity()) SaDist1=rangerOffset(200,entity():pos(),entity():forward()):distance()
rangerFilter(entity()) SaDist2=rangerOffset(200,entity():pos(),-entity():forward()):distance()
rangerFilter(entity()) SaDist3=rangerOffset(200,entity():pos(),entity():up()):distance()


if(SaDist1<150){Flip1=Flip1+1*Int} else{Flip1=0}
if(SaDist2<150){Flip2=Flip2+1*Int} else{Flip2=0}
if(SaDist3<100){Flip3=Flip3+1*Int} else{Flip3=0}

if(Flip3>=100){
if(round(random(-1,1))>0){entity():applyAngForce(ang( 1,0,0)*25000*entity():mass()*0.13) entity():applyForce(vec(0,0,20000*entity():mass()*0.015))}
else{entity():applyAngForce(ang(-1,0,0)*25000*entity():mass()*0.13) entity():applyForce(vec(0,0,20000*entity():mass()*0.015))}
Flip3=0
}

if(Dist1<Max&Dist2<Max){FrForce12=1} else{FrForce12=0}
if(Dist3<Max&Dist4<Max){FrForce34=1} else{FrForce34=0}
if(Dist5<Max&Dist6<Max){FrForce56=1} else{FrForce56=0}

if(Dist1<Max){entity():applyOffsetForce((entity():up()*(Hight-Dist1)-entity():right()*(Steer*( A-D)+(W-S)*Speed)*FrForce12)*Power*Mass*Int,entity():toWorld(vec( 0.4, 0.5,-0)*Scale)) Mul1=1} else{Mul1=0}
if(Dist2<Max){entity():applyOffsetForce((entity():up()*(Hight-Dist2)-entity():right()*(Steer*(-A+D)+(W-S)*Speed)*FrForce12)*Power*Mass*Int,entity():toWorld(vec(-0.4, 0.5,-0)*Scale)) Mul2=1} else{Mul2=0}
if(Dist3<Max){entity():applyOffsetForce((entity():up()*(Hight-Dist3)-entity():right()*(Steer*( A-D)+(W-S)*Speed)*FrForce34)*Power*Mass*Int,entity():toWorld(vec( 0.4, 0.0,-0)*Scale)) Mul3=1} else{Mul3=0}
if(Dist4<Max){entity():applyOffsetForce((entity():up()*(Hight-Dist4)-entity():right()*(Steer*(-A+D)+(W-S)*Speed)*FrForce34)*Power*Mass*Int,entity():toWorld(vec(-0.4, 0.0,-0)*Scale)) Mul4=1} else{Mul4=0}
if(Dist5<Max){entity():applyOffsetForce((entity():up()*(Hight-Dist5)-entity():right()*(Steer*( A-D)+(W-S)*Speed)*FrForce56)*Power*Mass*Int,entity():toWorld(vec( 0.4,-0.5,-0)*Scale)) Mul5=1} else{Mul5=0}
if(Dist6<Max){entity():applyOffsetForce((entity():up()*(Hight-Dist6)-entity():right()*(Steer*(-A+D)+(W-S)*Speed)*FrForce56)*Power*Mass*Int,entity():toWorld(vec(-0.4,-0.5,-0)*Scale)) Mul6=1} else{Mul6=0}

ForceMul=(Mul1+Mul2+Mul3+Mul4+Mul5+Mul6)/6

if(ForceMul>0){entity():applyAngForce(-entity():angVel()*ang(4,3,10)*Dumping*Mass*ForceMul*AngMul*Int*0.60)}
if(ForceMul>0){entity():applyForce((-entity():forward()*entity():velL():x()+entity():right()*entity():velL():y()*(0.2+(W+S)*0.05)-entity():up()*entity():velL():z()*1.5)*Dumping*Mass*ForceMul*Int)}


#Holos

Dir=0
if(entity():velL():y()>100){Dir=1}
if(entity():velL():y()<-100){Dir=-1}

RollR=RollR+(+entity():angVel():yaw()*0.5+entity():velL():y()*0.15)*0.2*Int*(ForceMul+abs(W-S))*0.5
RollL=RollL+(-entity():angVel():yaw()*0.5+entity():velL():y()*0.15)*0.2*Int*(ForceMul+abs(W-S))*0.5
if(RollR> 360){RollR=RollR-360}
if(RollR<-360){RollR=RollR+360}
if(RollL> 360){RollL=RollL-360}
if(RollL<-360){RollL=RollL+360}

if(changed(Dist1)){holoPos(1,entity():toWorld(vec( 0.4, 0.5,-(clamp(Dist1,48.5,Max+10))/Scale+Rad*0.45)*Scale))}
if(changed(Dist2)){holoPos(2,entity():toWorld(vec(-0.4, 0.5,-(clamp(Dist2,48.5,Max+10))/Scale+Rad*0.45)*Scale))}
if(changed(Dist3)){holoPos(3,entity():toWorld(vec( 0.4, 0.0,-(clamp(Dist3,48.5,Max+10))/Scale+Rad*0.45)*Scale))}
if(changed(Dist4)){holoPos(4,entity():toWorld(vec(-0.4, 0.0,-(clamp(Dist4,48.5,Max+10))/Scale+Rad*0.45)*Scale))}
if(changed(Dist5)){holoPos(5,entity():toWorld(vec( 0.4,-0.5,-(clamp(Dist5,48.5,Max+10))/Scale+Rad*0.45)*Scale))}
if(changed(Dist6)){holoPos(6,entity():toWorld(vec(-0.4,-0.5,-(clamp(Dist6,48.5,Max+10))/Scale+Rad*0.45)*Scale))}

if(changed(RollR+Steer)){holoAng(1,entity():toWorld(ang(RollR,90+(A-D)*15*Steer/SteerMul*Dir,90)))}
if(changed(RollL+Steer)){holoAng(2,entity():toWorld(ang(RollL,90+(A-D)*15*Steer/SteerMul*Dir,90)))}
if(changed(RollR)){holoAng(3,entity():toWorld(ang(RollR,90,90)))}
if(changed(RollL)){holoAng(4,entity():toWorld(ang(RollL,90,90)))}
if(changed(RollR+Steer)){holoAng(5,entity():toWorld(ang(RollR,90+(A-D)*15*Steer/SteerMul*-Dir,90)))}
if(changed(RollL+Steer)){holoAng(6,entity():toWorld(ang(RollL,90+(A-D)*15*Steer/SteerMul*-Dir,90)))}
holoAng(26,Main:toWorld(ang(0+random(-0.2,0.2)*(Speed/2*(W-S)+1),0,0)))


if(!Active&Open<90){Open=Open+1*Int}
if(Active&Open>0){Open=Open-1*Int}

#EGP

SpeedY=round(abs(toUnit("km/h",sqrt(sqrt(entity():vel():x()^2+entity():vel():y()^2)^2+entity():vel():z()^2))))
SpeedR=round(abs(toUnit("km/h",+entity():angVel():yaw()/0.3+entity():velL():y()*1)))
SpeedL=round(abs(toUnit("km/h",-entity():angVel():yaw()/0.3+entity():velL():y()*1)))

if(SpeedY<1){SpeedY=0}
if(SpeedY>999){SpeedY=0}

if(changed(SpeedY)){EGP1:egpText(24,SpeedY:toString(),vec2(20,40))}


if(SpeedR> 10){Changed[ "1R",number]=1} else{Changed[ "1R",number]=0}
if(SpeedR> 20){Changed[ "2R",number]=1} else{Changed[ "2R",number]=0}
if(SpeedR> 30){Changed[ "3R",number]=1} else{Changed[ "3R",number]=0}
if(SpeedR> 40){Changed[ "4R",number]=1} else{Changed[ "4R",number]=0}
if(SpeedR> 50){Changed[ "5R",number]=1} else{Changed[ "5R",number]=0}
if(SpeedR> 60){Changed[ "6R",number]=1} else{Changed[ "6R",number]=0}
if(SpeedR> 70){Changed[ "7R",number]=1} else{Changed[ "7R",number]=0}
if(SpeedR> 80){Changed[ "8R",number]=1} else{Changed[ "8R",number]=0}
if(SpeedR> 90){Changed[ "9R",number]=1} else{Changed[ "9R",number]=0}
if(SpeedR>100){Changed["10R",number]=1} else{Changed["10R",number]=0}
if(SpeedR>110){Changed["11R",number]=1} else{Changed["11R",number]=0}

if(SpeedL> 10){Changed[ "1L",number]=1} else{Changed[ "1L",number]=0}
if(SpeedL> 20){Changed[ "2L",number]=1} else{Changed[ "2L",number]=0}
if(SpeedL> 30){Changed[ "3L",number]=1} else{Changed[ "3L",number]=0}
if(SpeedL> 40){Changed[ "4L",number]=1} else{Changed[ "4L",number]=0}
if(SpeedL> 50){Changed[ "5L",number]=1} else{Changed[ "5L",number]=0}
if(SpeedL> 60){Changed[ "6L",number]=1} else{Changed[ "6L",number]=0}
if(SpeedL> 70){Changed[ "7L",number]=1} else{Changed[ "7L",number]=0}
if(SpeedL> 80){Changed[ "8L",number]=1} else{Changed[ "8L",number]=0}
if(SpeedL> 90){Changed[ "9L",number]=1} else{Changed[ "9L",number]=0}
if(SpeedL>100){Changed["10L",number]=1} else{Changed["10L",number]=0}
if(SpeedL>110){Changed["11L",number]=1} else{Changed["11L",number]=0}


if(changed(Changed[ "1R",number])){EGP1:egpColor(22,Color*0.10*Changed[ "1R",number]+ColorO*(1-Changed[ "1R",number]))}
if(changed(Changed[ "2R",number])){EGP1:egpColor(20,Color*0.15*Changed[ "2R",number]+ColorO*(1-Changed[ "2R",number]))}
if(changed(Changed[ "3R",number])){EGP1:egpColor(18,Color*0.20*Changed[ "3R",number]+ColorO*(1-Changed[ "3R",number]))}
if(changed(Changed[ "4R",number])){EGP1:egpColor(16,Color*0.30*Changed[ "4R",number]+ColorO*(1-Changed[ "4R",number]))}
if(changed(Changed[ "5R",number])){EGP1:egpColor(14,Color*0.40*Changed[ "5R",number]+ColorO*(1-Changed[ "5R",number]))}
if(changed(Changed[ "6R",number])){EGP1:egpColor(12,Color*0.50*Changed[ "6R",number]+ColorO*(1-Changed[ "6R",number]))}
if(changed(Changed[ "7R",number])){EGP1:egpColor(10,Color*0.60*Changed[ "7R",number]+ColorO*(1-Changed[ "7R",number]))}
if(changed(Changed[ "8R",number])){EGP1:egpColor( 8,Color*0.70*Changed[ "8R",number]+ColorO*(1-Changed[ "8R",number]))}
if(changed(Changed[ "9R",number])){EGP1:egpColor( 6,Color*0.80*Changed[ "9R",number]+ColorO*(1-Changed[ "9R",number]))}
if(changed(Changed["10R",number])){EGP1:egpColor( 4,Color*0.90*Changed["10R",number]+ColorO*(1-Changed["10R",number]))}
if(changed(Changed["11R",number])){EGP1:egpColor( 2,Color*1.00*Changed["11R",number]+ColorO*(1-Changed["11R",number]))}

if(changed(Changed[ "1L",number])){EGP1:egpColor(21,Color*0.10*Changed[ "1L",number]+ColorO*(1-Changed[ "1L",number]))}
if(changed(Changed[ "2L",number])){EGP1:egpColor(19,Color*0.15*Changed[ "2L",number]+ColorO*(1-Changed[ "2L",number]))}
if(changed(Changed[ "3L",number])){EGP1:egpColor(17,Color*0.20*Changed[ "3L",number]+ColorO*(1-Changed[ "3L",number]))}
if(changed(Changed[ "4L",number])){EGP1:egpColor(15,Color*0.30*Changed[ "4L",number]+ColorO*(1-Changed[ "4L",number]))}
if(changed(Changed[ "5L",number])){EGP1:egpColor(13,Color*0.40*Changed[ "5L",number]+ColorO*(1-Changed[ "5L",number]))}
if(changed(Changed[ "6L",number])){EGP1:egpColor(11,Color*0.50*Changed[ "6L",number]+ColorO*(1-Changed[ "6L",number]))}
if(changed(Changed[ "7L",number])){EGP1:egpColor( 9,Color*0.60*Changed[ "7L",number]+ColorO*(1-Changed[ "7L",number]))}
if(changed(Changed[ "8L",number])){EGP1:egpColor( 7,Color*0.70*Changed[ "8L",number]+ColorO*(1-Changed[ "8L",number]))}
if(changed(Changed[ "9L",number])){EGP1:egpColor( 5,Color*0.80*Changed[ "9L",number]+ColorO*(1-Changed[ "9L",number]))}
if(changed(Changed["10L",number])){EGP1:egpColor( 3,Color*0.90*Changed["10L",number]+ColorO*(1-Changed["10L",number]))}
if(changed(Changed["11L",number])){EGP1:egpColor( 1,Color*1.00*Changed["11L",number]+ColorO*(1-Changed["11L",number]))}


Tick=Tick+0.1
CMax=120
EMax=50

if(changed(round(Tick))){EGP1:egpColor(35,vec(255*(1-clamp(Dist2,1,CMax)/CMax),255*((clamp(Dist2,1,CMax/2))/(CMax-CMax/2)),0))}
if(changed(round(Tick))){EGP1:egpColor(36,vec(255*(1-clamp(Dist4,1,CMax)/CMax),255*((clamp(Dist4,1,CMax/2))/(CMax-CMax/2)),0))}
if(changed(round(Tick))){EGP1:egpColor(37,vec(255*(1-clamp(Dist6,1,CMax)/CMax),255*((clamp(Dist6,1,CMax/2))/(CMax-CMax/2)),0))}
if(changed(round(Tick))){EGP1:egpColor(38,vec(255*(1-clamp(Dist1,1,CMax)/CMax),255*((clamp(Dist1,1,CMax/2))/(CMax-CMax/2)),0))}
if(changed(round(Tick))){EGP1:egpColor(39,vec(255*(1-clamp(Dist3,1,CMax)/CMax),255*((clamp(Dist3,1,CMax/2))/(CMax-CMax/2)),0))}
if(changed(round(Tick))){EGP1:egpColor(40,vec(255*(1-clamp(Dist5,1,CMax)/CMax),255*((clamp(Dist5,1,CMax/2))/(CMax-CMax/2)),0))}


if((W+A+S+D)&EnLoad<(Speed-SpeedY*0.2)){EnLoad=EnLoad+0.3} else{if(EnLoad>0){EnLoad=EnLoad-0.3}}

if(changed(EnLoad)){EGP1:egpColor(33,vec(255*(1-clamp(50-EnLoad,1,EMax)/EMax),255*((clamp(50-EnLoad,1,EMax/2))/(EMax-EMax/2)),0))}

EGP1:entity():setColor(vec(255,255,255))

#Sound

if(changed(Active)&Active==0&First==0){
soundStop(129)
soundStop(130)
entity():soundPlay(131,100,"/ambient/machines/thumper_shutdown1.wav")
}

if(Active){SoundPlay=SoundPlay+1 if(SUpMul<1){SUpMul=SUpMul+0.01}} else{SoundPlay=0 First=0 Powered=0 if(SUpMul>0){SUpMul=SUpMul-0.01}}

if(SoundPlay==1){
soundStop(131)
entity():soundPlay(128,100,"/ambient/machines/thumper_startup1.wav")
}
if(SoundPlay==15){
soundStop(129)
soundStop(130)
Powered=1
}

if(SoundPlay==20){
entity():soundPlay(129,100,"/npc/manhack/mh_engine_loop1.wav")
entity():soundPlay(130,100,"/thrusters/mh1.wav")
}


if(SoundPlay>3000){SoundPlay=14}

soundPitch(129,(50+(SpeedY*0.7+(15-15*ForceMul)*abs(W-S)))*SUpMul)
soundPitch(130,(30+clamp((SpeedY*0.7+(15-15*ForceMul)*abs(W-S)),0,50))*SUpMul)



}
}




