Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name all in one tank chip by dakota V36 Rick edit
- @inputs Turret:entity Pod:wirelink CamController:wirelink Gun:entity Gun2:entity W A S D Space Scope CamToggle Engine:entity
- @outputs [ANGLE CLAMPANG]:angle [HitPosition HitPosition2]:vector Throttle GearOut GearTC LgearTC RgearTC LgearOut RgearOut Lclutch Rclutch HardBrake Zoom
- @persist Gear Lgear Rgear GEARTIME Speed Active Dualclutch Dualgearbox Rev CamToggle ThirdPerson FirstPerson CAMTIME
- @persist Brakepower Turnpower Twospeed Fourspeed Sixspeed Eightspeed ThirdPos:vector ThirdDist FirstPos:vector FirstDist
- @persist Seat:entity MainHoloColor:vector CupolaHoloColor:vector RotateWithHull WheelCount WheelModel:string Wheels:array EntAng:angle LocAng:angle Y P ReloadSound:string TreadSound:string TurretSound:string RotationSpeed CupolaRotationSpeed POS:vector ANG:angle Tank:array HOLDANG Elevation Depression YawMin YawMax CupolaElevation CupolaDepression CupolaYawMin CupolaYawMax Cupola ShiftTime TransferCase Magnification HoloMarker
- @trigger
- if(first()|dupefinished()){
- #Instructions - Revision 36
- #EDITED FOR RICK's
- #MAKE SURE E2 ARROW POINTS FORWARD!
- #IMPORTANT: if you want the camera to work then the only thing you should check is to have
- #client side movement checked, though you can have the extras checked without any issue
- #for example: auto unclipping and hide player, you can set client side movement if you want,
- #but I setup extra view modes and a section to change them if you understand how.
- #Wire Turret to an entity marker that marks the baseprop of the turret (or use the gun if you are using a tank destroyer)
- #Wire Pod to the pod controller
- #Wire CamController to the cam controller
- #Wire Gun to the gun
- #Wire Gun2 to the second gun if you have one and are using two of the same gun side by side
- #Wire Throttle on the engine to Throttle
- #Wire W,A,S, and D to W,A,S, and D on the pod controller
- #Wire Engine to the engine (or one of the engines)
- #Wire CamToggle to your preference of key on the pod controller, this swaps views
- #Wire FOV on the cam controller to Zoom on the e2
- #Wire Scope to your preference of key on the pod controller, this zooms in when held
- #dual clutch instructions
- #Wire Gear on the dual clutch gearbox to GearOut
- #Wire Right clutch and Right brake on the gearbox to Rclutch
- #Wire Left clutch and Left brake on the gearbox Lclutch
- #dual gearbox instructions
- #Wire Gear on the left gearbox to LgearOut
- #Wire Gear on the right gearbox to RgearOut
- #Wire clutch and brake on the left gearbox to Lclutch
- #Wire clutch and brake on the right gearbox to Rclutch
- #transfer case for reverse instructions
- #Wire Gear on the transfer case to GearTC
- #if two transfer cases
- #Wire Gear on the left transfer case to LgearTC
- #Wire Gear on the right transfer case to RgearTC
- #tips
- #for crosshairs use an advanced hud indicator and link worldpos to HitPosition on the e2
- #by default the camera is first person, set a key for toggling to go to third
- #this is the beginning of the section you modify, just select things
- #and read instructions and you will be fine.
- #is it dual clutch or dual gearbox?
- Dualclutch = 1 #1 if dual clutch 0 if not
- Dualgearbox = 0 #1 if dual gearbox 0 if not
- #enable if you use a transfercase to reverse that is connected to another gearbox that only goes forward
- TransferCase = 0
- #how many gears do you have? only place a 1 by one option
- Twospeed = 0 #Transfer cases or CVTs
- Fourspeed = 0 # 4-speed gearbox
- Sixspeed = 0 # 6-speed gearbox
- Eightspeed = 1 # 8-speed gearbox
- #These are for the turning and braking power of the vehicle,
- #lower them if you spaz, raise them if you want to turn or brake faster
- Turnpower = 20 #turning power
- Brakepower = 20 #braking power
- #do you want the engine to rev while idle or not
- Rev = 0 #this is good for quick starts but can be loud and is horrible on fuel
- #NOTE: best used with multiple engines if a cvt is used
- #time in milliseconds*interval between gear shifts
- ShiftTime = 5
- #Set to 1 if the secondary gun is mounted on a secondary turret
- Cupola = 0
- RotationSpeed = 5.0 #how fast the turret can rotate. Consider that 1.0 = 10degrees/second
- CupolaRotationSpeed = 20.0 #how fast the secondary turret can rotate
- RotateWithHull = 0 #Set this to one if you want the turret to rotate with the hull
- #Zoom Options
- Magnification = 30 #Scope's zoom value - goes from 1 to 90, 1 is highest zoom, 90 is lowest, set higher for low vel projectiles
- #NOTE: have the e2 arrow point forward
- #Don't set any of these to negatives or things break
- Elevation = 15 #How High you can aim up
- Depression = 7 #How low you can aim down
- YawMin = 360 #How far your turret can spin Left
- YawMax = 360 #How far your turret can spin right
- #---Shit under this is for if you have a mini turret on your turret---#
- CupolaElevation = 55 #Up
- CupolaDepression = 15 #Down
- CupolaYawMin = 360 #Right
- CupolaYawMax = 360 #Left
- #Crosshair toggle: set this to 1 if you want a hologram to mark the point the gun is aiming at, this doesn't account for speed when fired or bullet drop.
- HoloMarker = 0
- MainHoloColor = vec(255,0,0)
- CupolaHoloColor = vec(0,0,255)
- #Sounds
- TreadSound = "acf_extra/tankfx/heavy_tracks.wav"
- TurretSound = "acf_extra/tankfx/turret5.wav"
- #ReloadSound = "acf_extra/tankfx/gnomefather/reload14.wav"
- #Wheel model (the road wheels)
- WheelModel = "models/sprops/trans/miscwheels/tank30.mdl"
- #Camera Positions and distances
- ThirdPos=vec(0,0,160)
- ThirdDist=260
- FirstPos=vec(0,0,110)
- FirstDist=60
- #End of things you need to change
- if(HoloMarker==1){
- holoCreate(1,HitPosition)
- holoModel(1, "sphere")
- holoMaterial(1, "lights/white001")
- holoScale(1,vec(2.5,2.5,2.5))
- holoColor(1,MainHoloColor)
- if(Cupola==1){
- holoCreate(2,HitPosition2)
- holoModel(2, "sphere")
- holoMaterial(2, "lights/white001")
- holoScale(2,vec(2.5,2.5,2.5))
- holoColor(2,CupolaHoloColor)
- }
- }
- HOLDANG = entity():toLocal(Gun:angles()):yaw()
- Tank = entity():getConstraints()
- rangerFilter(Tank)
- rangerPersist(1)
- entity():isWeldedTo():soundPlay(1,0,TreadSound)
- entity():isWeldedTo():soundPlay(2,0,TurretSound)
- soundVolume(1,0)
- soundPitch(1,0)
- Wheels = array()
- WheelCount = 1
- for(I=1,Tank:count()){if(Tank[I,entity]:model() == WheelModel){Wheels[WheelCount,entity]=Tank[I,entity],WheelCount+=1}}
- }
- interval(100)
- ChangeRPM = Engine:acfRedline()*90/100
- DownChangeRPM = Engine:acfPowerbandMin()
- Throttle=0
- Rclutch=0
- Lclutch=0
- if(Active==0|Rclutch+Lclutch>0){HardBrake=1}else{HardBrake=0}
- Active = Pod["Active",number]
- Seat = Pod["Entity",entity]
- #if(changed(Active)){reset()}
- if(Active==1){
- if(ThirdPerson == 0 & FirstPerson == 0 & CamToggle == 0){FirstPerson = 1, ThirdPerson = 0}
- CAMTIME = CAMTIME - 1
- if(CamToggle & CAMTIME<0){
- if(ThirdPerson==1){FirstPerson = 1, ThirdPerson = 0, CAMTIME=10}
- elseif(FirstPerson==1){FirstPerson = 0, ThirdPerson = 1, CAMTIME=10}}
- if(ThirdPerson){
- CAMPOSITION=entity():isWeldedTo():toWorld(ThirdPos)
- CAMDIST=ThirdDist}
- elseif(FirstPerson){
- CAMPOSITION=Turret:toWorld(FirstPos)
- CAMDIST=FirstDist}
- CamController["Activated", number] = Active
- CamController["Position", vector] = CAMPOSITION
- CamController["Distance", number] = CAMDIST
- CamController["Parent", entity] = Seat
- if(!W&!S&!A&!D&!Space){Gear=0,Lgear=0,Rgear=0}
- if(Space){Gear=0,Lgear=0,Rgear=0}
- if(Gear==0){GearOut=1}else{GearOut=Gear}
- if(Lgear==0){LgearOut=1}else{LgearOut=Lgear}
- if(Rgear==0){RgearOut=1}else{RgearOut=Rgear}
- if(Engine:acfRPM()<ChangeRPM/4){Gear=0,Lgear=0,Rgear=0}
- if(Dualclutch==1&TransferCase==0){GEARTIME = GEARTIME - 1
- if(S&!W&Twospeed){Gear = 2}
- if(!S&W&Twospeed){Gear = 1}
- if(Fourspeed){
- if(S&!W){Gear=4}else{
- if(W&!S&Gear==4){Gear=1}else{
- if(Engine:acfRPM()>ChangeRPM&Gear<=2&!S&W&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Gear<=3&!S&W&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear-1}}}}
- elseif(Sixspeed){
- if(S&!W){Gear=6}else{
- if(W&!S&Gear==6){Gear=1}else{
- if(Engine:acfRPM()>ChangeRPM&Gear<=4&!S&W&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Gear<=5&!S&W&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear-1}}}}
- elseif(Eightspeed){
- if(S&!W){Gear=8}else{
- if(W&!S&Gear==8){Gear=1}else{
- if(Engine:acfRPM()>ChangeRPM&Gear<=6&!S&W&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Gear<=7&!S&W&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear-1}}}}
- if(W|A|S|D){Throttle=100}
- if(A&!Space){Rclutch = Turnpower}else{Rclutch = 0}
- if(D&!Space){Lclutch = Turnpower}else{Lclutch = 0}
- if(Space){Rclutch = Brakepower}
- if(Space){Lclutch = Brakepower}
- if(!W&!S&!A&!D&!Space){Rclutch = Brakepower}
- if(!W&!S&!A&!D&!Space){Lclutch = Brakepower}
- if(!W&!S&!A&!D&!Space&Rev){Throttle = 100}}
- if(Dualgearbox==1&TransferCase==0){GEARTIME = GEARTIME - 1
- if(A&Twospeed&!W&!S){Lgear=2,Rgear=1}
- elseif(D&Twospeed&!W&!S){Lgear=1,Rgear=2}
- elseif(A&Fourspeed&!W&!S){Lgear=4,Rgear=1}
- elseif(D&Fourspeed&!W&!S){Lgear=1,Rgear=4}
- elseif(A&Sixspeed&!W&!S){Lgear=6,Rgear=1}
- elseif(D&Sixspeed&!W&!S){Lgear=1,Rgear=6}
- elseif(A&Eightspeed&!W&!S){Lgear=8,Rgear=1}
- elseif(D&Eightspeed&!W&!S){Lgear=1,Rgear=8}
- if(!S&W&Twospeed){Lgear = 1,Rgear = 1}
- if(S&!W&Twospeed){Lgear = 2,Rgear = 2}
- if(Fourspeed){
- if(S&!W){Lgear=4,Rgear=4}else{
- if(W&!S&(Lgear==4|Rgear==4)){Rgear=1,Lgear=1}else{
- if(Engine:acfRPM()>ChangeRPM&Lgear<=2&Rgear<=2&!S&W&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear+1,Lgear=Lgear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Lgear<=3&Rgear<=3&!S&W&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear-1,Lgear=Lgear-1}}}}
- if(Sixspeed){
- if(S&!W){Lgear=6,Rgear=6}else{
- if(W&!S&(Lgear==6|Rgear==6)){Rgear=1,Lgear=1}else{
- if(Engine:acfRPM()>ChangeRPM&Lgear<=4&Rgear<=4&!S&W&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear+1,Lgear=Lgear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Lgear<=5&Rgear<=5&!S&W&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear-1,Lgear=Lgear-1}}}}
- if(Eightspeed){
- if(S&!W){Lgear=8,Rgear=8}else{
- if(W&!S&(Lgear==8|Rgear==8)){Rgear=1,Lgear=1}else{
- if(Engine:acfRPM()>ChangeRPM&Lgear<=6&Rgear<=6&!S&W&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear+1,Lgear=Lgear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Lgear<=7&Rgear<=7&!S&W&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear-1,Lgear=Lgear-1}}}}
- if(W|A|S|D){Throttle=100}
- if(D&W|D&S){Rclutch = Turnpower}
- if(A&W|A&S){Lclutch = Turnpower}
- if(Space){Rclutch = Brakepower}
- if(Space){Lclutch = Brakepower}
- if(!W&!S&!A&!D&!Space){Rclutch = Brakepower}
- if(!W&!S&!A&!D&!Space){Lclutch = Brakepower}
- if(!W&!S&!A&!D&!Space&Rev){Throttle = 100}}
- if(Dualclutch==1&TransferCase==1){GEARTIME = GEARTIME - 1
- if(S&!W){GearTC = 2}else{GearTC = 1}
- if(Twospeed){
- if(Engine:acfRPM()>ChangeRPM&Gear<=1&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Gear<=2&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear-1}}
- if(Fourspeed){
- if(Engine:acfRPM()>ChangeRPM&Gear<=3&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Gear<=4&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear-1}}
- if(Sixspeed){
- if(Engine:acfRPM()>ChangeRPM&Gear<=5&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Gear<=6&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear-1}}
- if(Eightspeed){
- if(Engine:acfRPM()>ChangeRPM&Gear<=7&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Gear<=8&Gear>1&GEARTIME<=0){GEARTIME=ShiftTime,Gear=Gear-1}}
- if(W|A|S|D){Throttle=100}
- if(A&!Space){Rclutch = Turnpower}else{Rclutch = 0}
- if(D&!Space){Lclutch = Turnpower}else{Lclutch = 0}
- if(Space){Rclutch = Brakepower}
- if(Space){Lclutch = Brakepower}
- if(!W&!S&!A&!D&!Space){Rclutch = Brakepower}
- if(!W&!S&!A&!D&!Space){Lclutch = Brakepower}
- if(!W&!S&!A&!D&!Space&Rev){Throttle = 100}}
- if(Dualgearbox==1&TransferCase==1){GEARTIME = GEARTIME - 1
- if(S&!W){LgearTC=2,RgearTC=2}else{RgearTC=1,LgearTC=1}
- if(A&Twospeed&!W&!S){LgearTC=2,RgearTC=1,Lgear=1,Rgear=1}
- elseif(D&Twospeed&!W&!S){LgearTC=1,RgearTC=2,Lgear=1,Rgear=1}
- elseif(A&Fourspeed&!W&!S){LgearTC=2,RgearTC=1,Lgear=1,Rgear=1}
- elseif(D&Fourspeed&!W&!S){LgearTC=1,RgearTC=2,Lgear=1,Rgear=1}
- elseif(A&Sixspeed&!W&!S){LgearTC=2,RgearTC=1,Lgear=1,Rgear=1}
- elseif(D&Sixspeed&!W&!S){LgearTC=1,RgearTC=2,Lgear=1,Rgear=1}
- elseif(A&Eightspeed&!W&!S){LgearTC=2,RgearTC=1,Lgear=1,Rgear=1}
- elseif(D&Eightspeed&!W&!S){LgearTC=1,RgearTC=2,Lgear=1,Rgear=1}
- if(Twospeed){
- if(Engine:acfRPM()>ChangeRPM&Lgear<=1&Rgear<=1&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear+1,Lgear=Lgear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Lgear<=2&Rgear<=2&Rgear>1&Lgear>1&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear-1,Lgear=Lgear-1}}
- if(Fourspeed){
- if(Engine:acfRPM()>ChangeRPM&Lgear<=3&Rgear<=3&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear+1,Lgear=Lgear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Lgear<=4&Rgear<=4&Rgear>1&Lgear>1&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear-1,Lgear=Lgear-1}}
- if(Sixspeed){
- if(Engine:acfRPM()>ChangeRPM&Lgear<=5&Rgear<=5&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear+1,Lgear=Lgear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Lgear<=6&Rgear<=6&Rgear>1&Lgear>1&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear-1,Lgear=Lgear-1}}
- if(Eightspeed){
- if(Engine:acfRPM()>ChangeRPM&Lgear<=7&Rgear<=7&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear+1,Lgear=Lgear+1}
- elseif(Engine:acfRPM()<DownChangeRPM&Lgear<=8&Rgear<=8&Rgear>1&Lgear>1&GEARTIME<=0){GEARTIME=ShiftTime,Rgear=Rgear-1,Lgear=Lgear-1}}
- if(W|A|S|D){Throttle=100}
- if(D&W|D&S){Rclutch = Turnpower}
- if(A&W|A&S){Lclutch = Turnpower}
- if(Space){Rclutch = Brakepower}
- if(Space){Lclutch = Brakepower}
- if(!W&!S&!A&!D&!Space){Rclutch = Brakepower}
- if(!W&!S&!A&!D&!Space){Lclutch = Brakepower}
- if(!W&!S&!A&!D&!Space&Rev){Throttle = 100}}
- if(Scope){Zoom=Magnification}else{Zoom=90}
- rangerHitEntities(1)
- rangerFilter(Tank)
- HitPosition = rangerOffset(1000000,Gun:attachmentPos("muzzle"), Gun:forward()):position()
- if(Cupola){HitPosition2 = rangerOffset(1000000,(Gun2:attachmentPos("muzzle")), Gun2:forward()):position()}
- if(HoloMarker){
- holoPos(1,HitPosition)
- holoPos(2,HitPosition2)
- holoVisible(1,players(),0)
- holoVisible(1,Seat:driver(),1)
- holoVisible(2,players(),0)
- holoVisible(2,Seat:driver(),1)
- }
- CAM1 = CamController["CamPos", vector]
- CAM2 = CamController["HitPos", vector]
- CAMANG = CamController["CamAng", angle]
- if(RotateWithHull==1){
- GunPos = Gun:attachmentPos("muzzle") - Gun:forward() * Gun:boxSize():x()*0.75
- GunAng = (rangerOffset(9999999999,CAM2,CAMANG:forward()):pos() - GunPos):toAngle()
- ANGLE = clamp(Gun:toLocal(GunAng),ang(-RotationSpeed),ang(RotationSpeed))+ang(0,entity():isWeldedTo():angVel():yaw()*0.12,0)
- CLAMPANG = clamp(entity():toLocal(Gun:toWorld(ANGLE)),ang(-Elevation,-YawMin,-1),ang(Depression,YawMax,1))
- Gun:applyAngForce((Gun:toLocal(entity():toWorld(CLAMPANG)) * 250 - Gun:angVel() * 30) * shiftL(ang(Gun:inertia())))
- if(abs(ANGLE:yaw())>1){
- Play = 0
- if(!(CLAMPANG:yaw()+1>=YawMax|CLAMPANG:yaw()-1<=-YawMin)){Play=1}
- }
- if(Cupola==1){
- GunPos2 = Gun2:attachmentPos("muzzle") - Gun2:forward() * Gun2:boxSize():x()*0.75
- GunAng2 = (rangerOffset(9999999999,CAM2,CAMANG:forward()):pos() - GunPos2):toAngle()
- ANGLE2 = clamp(Gun2:toLocal(GunAng2),ang(-CupolaRotationSpeed),ang(CupolaRotationSpeed))+ang(0,Turret:angVel():yaw()*0.12,0)
- CLAMPANG2 = clamp(entity():toLocal(Gun2:toWorld(ANGLE2)),ang(-CupolaElevation,-CupolaYawMin,-1),ang(CupolaDepression,CupolaYawMax,1))
- Gun2:applyAngForce((Gun2:toLocal(entity():toWorld(CLAMPANG2)) * 250 - Gun2:angVel() * 30) * shiftL(ang(Gun2:inertia())))
- }}
- else{
- GunPos = Gun:attachmentPos("muzzle") - Gun:forward() * Gun:boxSize():x()*0.75
- GunAng = (rangerOffset(9999999999,CAM2,CAMANG:forward()):pos() - GunPos):toAngle()
- ANGLE = clamp(Gun:toLocal(GunAng),ang(-RotationSpeed),ang(RotationSpeed))
- CLAMPANG = clamp(entity():toLocal(Gun:toWorld(ANGLE)),ang(-Elevation,-YawMin,-1),ang(Depression,YawMax,1))
- Gun:applyAngForce((Gun:toLocal(entity():toWorld(CLAMPANG)) * 250 - Gun:angVel() * 30) * shiftL(ang(Gun:inertia())))
- if(abs(ANGLE:yaw())>1){
- Play = 0
- if(!(CLAMPANG:yaw()+1>=YawMax|CLAMPANG:yaw()-1<=-YawMin)){Play=1}
- }
- if(Cupola==1){
- GunPos2 = Gun2:attachmentPos("muzzle") - Gun2:forward() * Gun2:boxSize():x()*0.75
- GunAng2 = (rangerOffset(9999999999,CAM2,CAMANG:forward()):pos() - GunPos2):toAngle()
- ANGLE2 = clamp(Gun2:toLocal(GunAng2),ang(-CupolaRotationSpeed),ang(CupolaRotationSpeed))
- CLAMPANG2 = clamp(entity():toLocal(Gun2:toWorld(ANGLE2)),ang(-CupolaElevation,-CupolaYawMin,-1),ang(CupolaDepression,CupolaYawMax,1))
- Gun2:applyAngForce((Gun2:toLocal(entity():toWorld(CLAMPANG2)) * 250 - Gun2:angVel() * 30) * shiftL(ang(Gun2:inertia())))
- }}
- }
- if(Active==0){
- interval(100)
- ANG=entity():toWorld(ang(0,0,0))
- Q=quat(ANG)/quat(Gun)
- Torque=Gun:toLocal(rotationVector(Q) + Gun:pos())
- Torque=((Torque*250) -Gun:angVelVector()* 50)*Gun:inertia()
- Gun:applyTorque(Torque)
- Gun:applyTorque(-Gun:angVelVector()*pi()/180*Gun:inertia()*1550.1*1/2)
- if(Cupola==1){
- ANG2=entity():toWorld(ang(0,0,0))
- Q2=quat(ANG2)/quat(Gun2)
- Torque2=Gun2:toLocal(rotationVector(Q2) + Gun2:pos())
- Torque2=((Torque2*250) -Gun2:angVelVector()* 50)*Gun2:inertia()
- Gun2:applyTorque(Torque2)
- Gun2:applyTorque(-Gun2:angVelVector()*pi()/180*Gun2:inertia()*1550.1*1/2)
- }
- Rclutch = Brakepower
- Lclutch = Brakepower
- }
- #treads
- Vel = entity():isWeldedTo():vel()
- Speed = abs(Vel:x())+abs(Vel:y())
- if(Speed>30){
- soundVolume(1,Active*clamp(Speed/250,0.5,1))
- soundPitch(1,Active*clamp(Speed/2,25,100))
- }
- if(Speed<=150){Climb=1}
- if(Speed>150){Climb=0}
- #if(changed(Climb)&Climb){for(I=1,Wheels:count()){if(Wheels[I,entity]){Wheels[I,entity]:setPhysProp("phx_tire_normal",1)}}}
- #if(changed(Climb)&!Climb){for(I=1,Wheels:count()){if(Wheels[I,entity]){Wheels[I,entity]:setPhysProp("rubber",1)}}}
- #turret
- if(Play){
- soundVolume(2,1)
- soundPitch(2,100)
- }else{
- soundVolume(2,0)
- soundPitch(2,0)
- }
- #if((changed(Gun:acfMagRounds())&!Gun:acfMagRounds())){Gun:soundPlay(3,0,ReloadSound)}else{soundStop(3,soundDuration(ReloadSound))}
- #if((changed(Gun2:acfMagRounds())&!Gun2:acfMagRounds())){Gun2:soundPlay(4,0,ReloadSound)}else{soundStop(4,soundDuration(ReloadSound))}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement