SHARE
TWEET

Untitled

a guest Feb 27th, 2020 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @name Brumble's HoverCar
  2. @inputs [Seat,Seat2,EGP]:entity [Lamp1,Lamp2]:wirelink
  3. @outputs
  4. @persist EGP2:wirelink
  5. @persist Mass Height HoverForceMult Tilt HeightShutoff MomentumStopMult Active HoverForceMult2 EngineOn
  6. @persist RotationStopMult ThrustForwardMult TForward TRight Yaw ThrustTurnMult MaxTurnSharpness Space
  7. @persist [Chassi,Grau,White,Black,Blue]:vector
  8. @persist E:entity Ang:angle
  9. @persist [Forward V1 V2 V3 V4]:vector
  10. @model models/hunter/plates/plate1x2.mdl
  11.  
  12. interval(60)
  13. runOnTick(1)
  14.  
  15. if(first()|dupefinished()){
  16.        
  17.     Height            = 50   #Change hover height | 50
  18.     HoverForceMult    = 2    #Change if ship is wobbly or for tiny tweeks | 2
  19.     HoverForceMult2   = 3.6  #Change to alter amount of upward force, Less = MORE FORCE, 1.6 is strong, 3.6 is loose |3.6
  20.     HeightShutoff     = 1    #More is higher before velocity slowdown shuts off | 1
  21.     MomentumStopMult  = 8    #Less is more auto-stop power | 8
  22.     RotationStopMult  = 0.9  #Less is more auto-stop power | 0.9
  23.     ThrustForwardMult = 45   #More is more thrust (More = higher speed) 45
  24.     ThrustTurnMult    = 10   #More is more turn | 10
  25.     MaxTurnSharpness  = 11   #More is a sharper turn, don't go much higher than 15 or so |11
  26.    
  27.        
  28.     E=entity()
  29.     E:setMass(1000)
  30.     E:setAlpha(255)
  31.     E:setMaterial("Models/effects/vol_light001")
  32.    
  33.     Inertia = shiftL(ang(E:inertia()))
  34.  
  35.     Mass=0
  36.     Props=E:getConstraints()
  37.     for(A=1, Props:count()) {Props[A,entity]:setMass(2) Mass=Mass+2}
  38.     Mass=Mass+E:mass()
  39.     TForward=0
  40.     TRight=0
  41.     Tilt=0
  42.  
  43.     rangerHitEntities(0)
  44.     rangerPersist(1)
  45.     rangerHitWater(1)
  46.     rangerFilter(Props)
  47.     rangerFilter(E)
  48.     rangerFilter(players())
  49.     findExcludePlayer(owner())
  50.  
  51.    
  52.     E:propFreeze(0)
  53.     E:propGravity(1)
  54.    
  55.    function entity c(Index:number,Posi:vector,Scale:vector,Angle:angle,Colo:vector,Model:string,Material:string,Parent:entity,Alpha:number){
  56.             holoCreate(Index) holoPos(Index,Posi) holoScale(Index,Scale) holoAng(Index,Angle) holoColor(Index,Colo) holoModel(Index,Model) holoMaterial(Index,Material)
  57.             holoParent(Index,Parent) holoAlpha(Index,Alpha)
  58.             return holoEntity(Index)  
  59.     }
  60.    
  61.    
  62.     Chassi = vec(155,155,155)
  63.     Grau   = vec(200,200,200)
  64.     White  = vec(255)
  65.     Black  = vec(0)
  66.     Blue   = vec(0,191,255)
  67.    
  68.     MatNor = "models/debug/debugwhite"
  69.     MatGla = "models/props_combine/health_charger_glass"
  70.     MatLog = "debug/env_cubemap_model"
  71.     MatSea = "models/XQM/Rails/gumball_1"
  72.    
  73.     #---[Holos]---#
  74.    
  75.     c(1,E:toWorld(vec(25,0,20)),vec(0.9,0.9,0.2),E:toWorld(ang(0,90,90)),Chassi,"models/hunter/tubes/tube2x2x025.mdl",MatNor,E,255)
  76.     c(2,E:toWorld(vec(25,0,20)),vec(0.844,0.844,0.2),E:toWorld(ang(0,90,90)),Chassi,"models/hunter/tubes/tube2x2x025.mdl",MatNor,E,255)
  77.     c(3,E:toWorld(vec(25,0,20)),vec(0.74,0.74,0.13),E:toWorld(ang(0,90,90)),White,"models/props_phx/construct/glass/glass_dome360.mdl",MatGla,E,255)  
  78.  
  79.     c(4,E:toWorld(vec(-25,0,20)),vec(0.9,0.9,0.2),E:toWorld(ang(0,90,90)),Chassi,"models/hunter/tubes/tube2x2x025.mdl",MatNor,E,255)  
  80.     c(5,E:toWorld(vec(-25,0,20)),vec(0.844,0.844,0.2),E:toWorld(ang(0,90,90)),Chassi,"models/hunter/tubes/tube2x2x025.mdl",MatNor,E,255)  
  81.     c(6,E:toWorld(vec(-25,0,20)),vec(0.74,0.74,0.13),E:toWorld(ang(0,-90,90)),White,"models/props_phx/construct/glass/glass_dome360.mdl",MatGla,E,255)  
  82.  
  83.     c(7,E:toWorld(vec(0,0,20)),vec(0.9,0.9,2.03),E:toWorld(ang(180,90,90)),Chassi,"models/hunter/tubes/tube2x2x05c.mdl",MatNor,E,255)
  84.     c(8,E:toWorld(vec(0,0,20)),vec(0.9,0.9,2),E:toWorld(ang(-35,90,90)),Chassi,"models/hunter/tubes/tube2x2x05d.mdl",MatNor,E,255)
  85.  
  86.     c(9,E:toWorld(vec(0,0,20)),vec(0.89,0.89,2),E:toWorld(ang(55,90,90)),White,"models/hunter/tubes/tube2x2x05d.mdl",MatGla,E,255)
  87.     holoClipEnabled(9,1)
  88.     holoClip(9,vec(0,-32.3,0),vec(0,-1,0),0)
  89.     c(10,E:toWorld(vec(0,0,20)),vec(0.89,0.89,2),E:toWorld(ang(90,90,90)),White,"models/hunter/tubes/tube2x2x05d.mdl",MatGla,E,255)
  90.  
  91.     c(11,E:toWorld(vec(-23.5,28,20)),vec(0.5,0.3,1),E:toWorld(ang(0,90,90)),Grau,"models/hunter/misc/roundthing2.mdl",MatSea,E,255)    
  92.     c(12,E:toWorld(vec(-23.48,9,-7)),vec(0.4,0.2,1),E:toWorld(ang(90,0,0)),Grau,"models/hunter/misc/roundthing2.mdl",MatSea,E,255)
  93.     c(13,E:toWorld(vec(0.25,20,-3)),vec(3.95,2,2),E:toWorld(ang(0,0,0)),Grau,"models/XQM/cylinderx1.mdl",MatSea,E,255)
  94.  
  95.     c(14,E:toWorld(vec(-23.48,0,-15)),vec(0.1,0.285,1),E:toWorld(ang(90,0,0)),Grau,"models/hunter/misc/roundthing2.mdl",MatNor,E,255)
  96.  
  97.     c(15,E:toWorld(vec(0,4,10)),vec(0.5,0.42,0.55),E:toWorld(ang(0,0,0)),White,"models/hunter/plates/plate05x1.mdl",MatNor,E,255)
  98.     c(16,E:toWorld(vec(0,11,7)), vec(0.5,0.15,0.55), E:toWorld(ang(0,0,50)),White,"models/hunter/plates/plate05x1.mdl",MatNor,E,255)
  99.     c(17,E:toWorld(vec(0,-0.6,4.5)),vec(0.5,0.42,0.55),E:toWorld(ang(0,0,0)),White,"models/hunter/plates/plate05x1.mdl",MatNor,E,255)
  100.     c(18,E:toWorld(vec(0,-12.3,2.1)),vec(0.5,0.15,0.55),E:toWorld(ang(0,0,50)),White,"models/hunter/plates/plate05x1.mdl",MatNor,E,255)
  101.     c(19,E:toWorld(vec(0,-4,-0.33)),vec(0.5,0.42,0.55),E:toWorld(ang(0,0,0)),White,"models/hunter/plates/plate05x1.mdl",MatNor,E,255)
  102.  
  103.  
  104.     #Back
  105.     c(20,E:toWorld(vec(0,53,20)),vec(0.5,0.5,0.7),E:toWorld(ang(0,0,90)),Chassi,"models/hunter/misc/roundthing2.mdl",MatNor,E,255)
  106.  
  107.     c(21,E:toWorld(vec(0,54,20)),vec(0.48,0.49,0.6),E:toWorld(ang(0,0,90)),Black,"models/hunter/misc/roundthing2.mdl",MatNor,E,255)
  108.  
  109.     c(22,E:toWorld(vec(0,53,43.6)),vec(0.25,0.25,0.2),E:toWorld(ang(90,0,90)),Chassi,"models/hunter/tubes/tube2x2x05c.mdl",MatNor,E,255)
  110.     c(23,E:toWorld(vec(0,53,-3.7)),vec(0.25,0.25,0.2),E:toWorld(ang(-90,0,90)),Chassi,"models/hunter/tubes/tube2x2x05c.mdl",MatNor,E,255)
  111.     c(24,E:toWorld(vec(11.12,53.91,20)),vec(0.25,0.80,0.255),E:toWorld(ang(0,90,90)),Chassi,"models/hunter/plates/plate025x125.mdl",MatNor,E,255)
  112.     c(25,E:toWorld(vec(-11.12,53.91,20)),vec(0.25,0.80,0.255),E:toWorld(ang(0,-90,90)),Chassi,"models/hunter/plates/plate025x125.mdl",MatNor,E,255)
  113.  
  114.     c(26,E:toWorld(vec(0,55.4,20)),vec(0.3,0.39,0.6),E:toWorld(ang(0,0,90)),Chassi,"models/hunter/misc/roundthing2.mdl",MatNor,E,255)
  115.    
  116.     c(64,E:toWorld(vec(0,53,38.5)),vec(0.195,0.15,0.2),E:toWorld(ang(90,0,90)),Chassi,"models/hunter/tubes/tube2x2x05c.mdl",MatNor,E,255)
  117.     c(65,E:toWorld(vec(0,53,1.4)),vec(0.195,0.15,0.2),E:toWorld(ang(-90,0,90)),Chassi,"models/hunter/tubes/tube2x2x05c.mdl",MatNor,E,255)
  118.    
  119.     c(66,E:toWorld(vec(0,53,38.5)),vec(0.27,0.2,0.2),E:toWorld(ang(90,0,90)),Chassi,"models/hunter/tubes/tube2x2x05c.mdl",MatNor,E,255)
  120.     c(67,E:toWorld(vec(0,53,1.4)),vec(0.27,0.2,0.2),E:toWorld(ang(-90,0,90)),Chassi,"models/hunter/tubes/tube2x2x05c.mdl",MatNor,E,255)
  121.    
  122.     c(68,E:toWorld(vec(-8.9,53.91,20)),vec(0.25,0.63,0.205),E:toWorld(ang(0,-90,90)),Chassi,"models/hunter/plates/plate025x125.mdl",MatNor,E,255)
  123.     c(69,E:toWorld(vec(9.5,53.91,20)),vec(0.25,0.63,0.205),E:toWorld(ang(0,-90,90)),Chassi,"models/hunter/plates/plate025x125.mdl",MatNor,E,255)
  124.     #
  125.    
  126.     c(27,E:toWorld(vec(0,-41,20)),vec(0.12,0.12,0.12),E:toWorld(ang(0,0,90)),White,"models/hunter/tubes/tube2x2x025.mdl",MatLog,E,255)
  127.     c(28,E:toWorld(vec(1.5,-41,22.8)),vec(0.12,0.2,0.3),E:toWorld(ang(25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  128.     c(29,E:toWorld(vec(-1.5,-41,22.8)),vec(0.12,0.2,0.3),E:toWorld(ang(-25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  129.     c(30,E:toWorld(vec(0,-41,20.84)),vec(0.08,0.095,0.3),E:toWorld(ang(90,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  130.  
  131.     c(31,E:toWorld(vec(1.5,-41,17.2)),vec(0.12,0.2,0.3),E:toWorld(ang(-25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  132.     c(32,E:toWorld(vec(-1.5,-41,17.2)),vec(0.12,0.2,0.3),E:toWorld(ang(25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  133.     c(33,E:toWorld(vec(0,-41,19.185)), vec(0.08,0.095,0.3), E:toWorld(ang(90,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  134.  
  135.     c(34,E:toWorld(vec(3.7,-41,18.5)), vec(0.12,0.252,0.3), E:toWorld(ang(25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  136.     c(35,E:toWorld(vec(4.845,-41,21.6)),vec(0.075,0.03,0.3),E:toWorld(ang(25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  137.     c(36,E:toWorld(vec(5.2,-41,21)),vec(0.05,0.02,0.3),E:toWorld(ang(25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  138.     c(37,E:toWorld(vec(4.89,-41,22.2)),vec(0.038,0.02,0.3),E:toWorld(ang(25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)
  139.  
  140.     c(38,E:toWorld(vec(-3.7,-41,18.5)),vec(0.12,0.252,0.3),E:toWorld(ang(-25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)  
  141.     c(39,E:toWorld(vec(-4.845,-41,21.6)),vec(0.075,0.03,0.3),E:toWorld(ang(-25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)  
  142.     c(40,E:toWorld(vec(-5.2,-41,21)),vec(0.05,0.02,0.3),E:toWorld(ang(-25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)  
  143.     c(41,E:toWorld(vec(-4.89,-41,22.2)),vec(0.038,0.02,0.3),E:toWorld(ang(-25,0,90)),White,"models/hunter/plates/plate025x05.mdl",MatLog,E,255)  
  144.    
  145.     c(42,E:toWorld(vec(-25,0,20)),vec(0.79,0.79,0.2),E:toWorld(ang(0,90,90)),Chassi,"models/hunter/tubes/tube2x2x025.mdl",MatNor,E,255)    
  146.     c(43,E:toWorld(vec(-25,0,20)), vec(0.74,0.74,0.2), E:toWorld(ang(0,90,90)),Black,"models/hunter/tubes/tube2x2x025.mdl",MatNor,E,255)    
  147.  
  148.     c(44,E:toWorld(vec(25,0,20)),vec(0.79,0.79,0.2),E:toWorld(ang(0,90,90)),Chassi,"models/hunter/tubes/tube2x2x025.mdl",MatNor,E,255)          
  149.     c(45,E:toWorld(vec(25,0,20)),vec(0.74,0.74,0.2),E:toWorld(ang(0,90,90)),Black,"models/hunter/tubes/tube2x2x025.mdl",MatNor,E,255)      
  150.  
  151.     c(46,E:toWorld(vec(22.6,0,20)),vec(0.9,0.9,0.1),E:toWorld(ang(90,90,90)),Black,"models/hunter/tubes/tube2x2x05d.mdl",MatNor,E,255)    
  152.     c(47,E:toWorld(vec(22.6,0,20)),vec(0.9,0.9,0.1),E:toWorld(ang(55,90,90)),Black,"models/hunter/tubes/tube2x2x05d.mdl",MatNor,E,255)  
  153.  
  154.     c(48,E:toWorld(vec(-22.6,0,20)),vec(0.9,0.9,0.1),E:toWorld(ang(90,90,90)),Black,"models/hunter/tubes/tube2x2x05d.mdl",MatNor,E,255)  
  155.     c(49,E:toWorld(vec(-22.6,0,20)), vec(0.9,0.9,0.1), E:toWorld(ang(55,90,90)),Black,"models/hunter/tubes/tube2x2x05d.mdl",MatNor,E,255)  
  156.  
  157.     c(50,E:toWorld(vec(0,-0.5,60)), vec(0.4,4,0.88), E:toWorld(ang(0,90,0)),Black,"models/hunter/plates/plate025.mdl",MatNor,E,255)  
  158.     c(51,E:toWorld(vec(0,-35.2,-4.2)),vec(0.4,4,0.88),E:toWorld(ang(52,90,0)),Black,"models/hunter/plates/plate025.mdl",MatNor,E,255)  
  159.  
  160.     #Lamps
  161.     c(70,E:toWorld(vec(18,0,20)),vec(0.9,0.9,0.1),E:toWorld(ang(60,90,90)),Black,"models/hunter/tubes/tube2x2x05d.mdl",MatNor,E,255)  
  162.     c(71,E:toWorld(vec(-18,0,20)),vec(0.9,0.9,0.1),E:toWorld(ang(60,90,90)),Black,"models/hunter/tubes/tube2x2x05d.mdl",MatNor,E,255)  
  163.  
  164.    for(B=1,8){
  165.    
  166.     c(55+B,E:toWorld(vec(0,-22.5+B*5,-15.8-sin(B*20)*6)),vec(4,0.3,0.2),E:toWorld(ang(0,0,0-cos(B*20)*25)),Blue,"cube",MatNor,E,255)  
  167.  
  168.     }
  169.    
  170.    for(A=1,80){ holoDisableShading(A,1) }
  171.  
  172. #6 Door rechts
  173. #3 Door links
  174.  
  175.  
  176.    function setupEntity(StrEntity:entity,Vec:vector,Ang:angle,Parent:entity){
  177.  
  178.    
  179.         if(!StrEntity:parent()){
  180.              
  181.              if(StrEntity){
  182.                   StrEntity:setPos(Vec)
  183.                   StrEntity:setAng(Ang)
  184.                    if(!StrEntity:isFrozen()){
  185.                      StrEntity:propFreeze(1)
  186.                    }
  187.                    if(StrEntity==EGP){
  188.                      EGP:setAlpha(5)
  189.                    }
  190.                   timer("setE",350)
  191.              }
  192.            
  193.          if(clk("setE")){
  194.           StrEntity:parentTo(Parent)
  195.           if(StrEntity==Seat||StrEntity==Seat2){
  196.             StrEntity:setAlpha(0)
  197.           }
  198.             stoptimer("setE")
  199.          }
  200.         }
  201.      
  202. }
  203.  
  204.     function wirelink:setupLamp(Pos:vector,Angle:angle,Parent:entity){
  205.         if(!This:entity():parent()){
  206.          if(This){
  207.           This:entity():setMass(50000)
  208.           This:entity():propFreeze(1)
  209.           This:entity():setPos(Pos)
  210.           This:entity():setAng(Angle)
  211.           This:entity():setAlpha(0)
  212.           timer("setL",350)
  213.         }
  214.         if(clk("setL")){
  215.          stoptimer("setL")
  216.          This:entity():parentTo(Parent)  
  217.         }
  218.        }
  219.     }
  220.    
  221.        #---[Start sound and toggle engine variable to on]---#
  222.    soundPlay(1,0,"vehicles/apc/apc_start_loop3.wav")
  223.    soundVolume(1,0.5)
  224.    EngineOn=1
  225. }
  226.  
  227.     C1=E:toWorld(E:boxSize()*vec( 0.5, -0.33, 0))
  228.     C2=E:toWorld(E:boxSize()*vec( -0.5, -0.33, 0))
  229.     C3=E:toWorld(E:boxSize()*vec( 0.5, 0.33, 0))
  230.     C4=E:toWorld(E:boxSize()*vec( -0.5, 0.33, 0))
  231.    
  232.     Forward  = E:right()
  233.     EPos = E:pos()
  234.     EAng = E:angles()
  235.  
  236. if(inrange(EAng,ang(-90,-180,-90),ang(90,180,90))){
  237.    
  238.        #---[Ranger bundle]---#
  239.    R1=rangerOffset(20000,C1,vec(0,0,-1))
  240.    D1=R1:distance()
  241.    R2=rangerOffset(20000,C2,vec(0,0,-1))
  242.    D2=R2:distance()
  243.    R3=rangerOffset(20000,C3,vec(0,0,-1))
  244.    D3=R3:distance()
  245.    R4=rangerOffset(20000,C4,vec(0,0,-1))
  246.    D4=R4:distance()
  247.    AverageHeight=(D1+D2+D3+D4)/4
  248.  
  249.        #---[Hover Code]---#
  250.  
  251.     if(D1<Height){
  252.         V1=(vec(0,0,Height-D1+Tilt))*Mass/HoverForceMult2
  253.         E:applyOffsetForce(V1+$V1*HoverForceMult,C1)
  254.     }
  255.     if(D2<Height){
  256.         V2=(vec(0,0,Height-D2-Tilt))*Mass/HoverForceMult2
  257.         E:applyOffsetForce(V2+$V2*HoverForceMult,C2)
  258.     }
  259.     if(D3<Height){
  260.         V3=(vec(0,0,Height-D3+Tilt))*Mass/HoverForceMult2
  261.         E:applyOffsetForce(V3+$V3*HoverForceMult,C3)
  262.     }
  263.     if(D4<Height){
  264.         V4=(vec(0,0,Height-D4-Tilt))*Mass/HoverForceMult2
  265.         E:applyOffsetForce(V4+$V4*HoverForceMult,C4)
  266.     }
  267.  
  268.    
  269.     if(E:isUnderWater()){
  270.        V100 = vec(0,0,40) * Mass
  271.        E:applyForce(V100)
  272.     }
  273.    
  274.        #---[Slowdown code]---#
  275.    if(AverageHeight<Height+HeightShutoff){
  276.        V5 = (( EPos - E:vel()/2 ) - EPos) * Mass/MomentumStopMult
  277.        E:applyForce(V5)
  278.    }
  279.    
  280.        #---[Stop Spin code]---#
  281.    A1 = (( EAng - E:angVel()/RotationStopMult) - EAng) * Mass
  282.    E:applyAngForce(A1)
  283.  
  284.  
  285.  
  286.        #---[Engine pitch control and reactivation of sound]---#
  287.    if(EngineOn==0){
  288.        soundPurge()
  289.        soundPlay(1,0,"vehicles/apc/apc_start_loop3.wav")
  290.        soundVolume(1,0.5)
  291.        EngineOn=1
  292.    }
  293.    soundPitch(1,50+abs(TForward))
  294.    
  295.  
  296.        #---[Seat controller]---#
  297.    if(Seat) {
  298.     Driver = Seat:driver()
  299.        W          = Driver:keyForward()
  300.        A          = Driver:keyLeft()
  301.        S          = Driver:keyBack()
  302.        D          = Driver:keyRight()
  303.        Space      = Driver:keyJump()
  304.        Shift      = Driver:keySprint()
  305.        M1         = Driver:keyAttack1()
  306.        M2         = Driver:keyAttack2()
  307.        
  308.        if(AverageHeight<Height+HeightShutoff){
  309.            if(Shift){
  310.                if(W){
  311.                    V6 = ((EPos + Forward*1000) - EPos) * Mass/1000 * ThrustForwardMult * 2
  312.                    E:applyForce(V6)
  313.                    if(TForward>0){ holoColor(21,vec(0)) }
  314.                    if(TForward<45){TForward=TForward+2} else{}
  315.                    
  316.                }
  317.                elseif(S){
  318.                    V6 = ((EPos - Forward*1000) - EPos) * Mass/1000 * ThrustForwardMult * 2
  319.                    E:applyForce(V6)
  320.                    if (TForward<-10){ holoColor(21,vec(255)) }else{ holoColor(21,vec(255,0,0)) }
  321.                    if (TForward>-45) {TForward=TForward-2} else{}
  322.                }
  323.                else{
  324.                    if(TForward>0){ holoColor(21,vec(0)) }
  325.                    if(TForward>0){TForward = TForward - 2}
  326.                    if(TForward<0){TForward = TForward + 2}
  327.                }
  328.            }
  329.            else{
  330.                if(W){
  331.                    V6 = ((EPos + Forward*1000) - EPos) * Mass/1000 * ThrustForwardMult
  332.                    E:applyForce(V6)
  333.                    if(TForward>0){ holoColor(21,vec(0)) }
  334.                    if(TForward<30){TForward=TForward+2}
  335.                    elseif(TForward>31) {TForward=TForward-2}
  336.                    else{}
  337.                }
  338.                elseif(S){
  339.                    V6 = ((EPos - Forward*1000) - EPos) * Mass/1000 * ThrustForwardMult
  340.                    E:applyForce(V6)
  341.                    if (TForward<-10){ holoColor(21,vec(255)) }else{ holoColor(21,vec(255,0,0)) }
  342.                    if (TForward>-30) {TForward=TForward-2}
  343.                    elseif(TForward<-31) {TForward=TForward+2}
  344.                    else{}
  345.                }
  346.                else{
  347.                    if(TForward>0){ holoColor(21,vec(0)) }
  348.                    if(TForward>0){TForward = TForward - 2}
  349.                    if(TForward<0){TForward = TForward + 2}
  350.                }
  351.            }
  352.  
  353.        }
  354.  
  355.     #---[Lamp Controll]---#
  356.  
  357.     if(M2){
  358.           if(Lamp1){ Lamp1["On",number] = 0 }
  359.           if(Lamp2){ Lamp2["On",number] = 0 }  
  360.           holoColor(70,vec(0))
  361.           holoColor(71,vec(0))
  362.     }elseif(M1){
  363.           if(Lamp1){ Lamp1["On",number] = 1 , Lamp1["RGB",vector] = vec(255,255,255)}
  364.           if(Lamp2){ Lamp2["On",number] = 1 , Lamp2["RGB",vector] = vec(255,255,255)}
  365.           holoColor(70,vec(255))
  366.           holoColor(71,vec(255))
  367.     }
  368.            
  369.        
  370.     #---[Turning code, which includes turningtilt]---#
  371.    
  372.        if(A & S){
  373.            if(Yaw >-MaxTurnSharpness){Yaw--}
  374.            if(Tilt>-4){Tilt=Tilt - 0.2}
  375.        }
  376.        elseif(D & S){
  377.            if(Yaw < MaxTurnSharpness){Yaw++}
  378.            if(Tilt<4) {Tilt=Tilt + 0.2}
  379.        }
  380.        elseif(A){
  381.            if(Yaw < MaxTurnSharpness){Yaw++}
  382.            if(Tilt>-4){Tilt=Tilt - 0.2}
  383.        }
  384.        elseif(D){
  385.            if(Yaw >-MaxTurnSharpness){Yaw--}
  386.            if(Tilt<4) {Tilt=Tilt + 0.2}
  387.        }
  388.        else{
  389.            if(Yaw  > 0) {Yaw--}
  390.            if(Yaw  < 0) {Yaw++}
  391.            if(Tilt > 0) {Tilt=Tilt-0.2}
  392.            if(Tilt < 0) {Tilt=Tilt+0.2}
  393.            if(inrange(Tilt, -0.5, 0.5)){Tilt=0}
  394.        }
  395.        
  396.        if(Yaw!=0){
  397.            Ang = (EAng:setYaw(EAng:yaw() + Yaw) - EAng) * Mass * ThrustTurnMult
  398.            E:applyAngForce(Ang + $Ang * 5)
  399.        }        
  400.    }
  401.    elseif($Active){Yaw=0 Tilt=0 TForward=0}
  402. }
  403. else{
  404.    TForward=0
  405.    soundPitch(1,50)
  406.    if(EngineOn){
  407.        soundPurge()
  408.        soundPlay(2,0,"vehicles/apc/apc_shutdown.wav")
  409.        soundVolume(2,0.5)
  410.        soundPitch(2,50)
  411.        EngineOn=0
  412.    }
  413. }
  414.  
  415.  
  416.     #---[EGP HUD]---#
  417. if(EGP){ EGP2=EGP:wirelink() }
  418.  
  419.  
  420. if(Driver){
  421.  
  422. local Mode    = "km/h"
  423. local H       = round(AverageHeight/1)
  424. local Speed   = floor(E:vel():length() / 10.9)
  425. local S       = round(Speed/1)
  426. local S2      = round(Speed/1.75)
  427.  
  428.    
  429. if(changed(EGP2)){  EGP2:egpClear()   }
  430.  
  431.     EGP2:egpBox(1,vec2(180,420),vec2(10,80))
  432.     EGP2:egpColor(1,vec(247,211,88))
  433.     EGP2:egpAlpha(1,50)
  434.  
  435.     EGP2:egpText(4,H + " Height", vec2(190,430))
  436.     EGP2:egpSize(4, 13)
  437.     EGP2:egpColor(4,vec(247,211,88))
  438.  
  439.  
  440. if(Mode=="km/h"){
  441.    
  442.     EGP2:egpText(3,S + " km/h", vec2(190,410))
  443.     EGP2:egpSize(3, 13)
  444.     EGP2:egpColor(3,vec(247,211,88))
  445.    
  446.     EGP2:egpBox(2,vec2(180,420),vec2(9,S2))
  447.     EGP2:egpColor(2,vec(0,0,0))
  448.     EGP2:egpAlpha(2,180)
  449.    
  450. }
  451.  
  452. }else{
  453.  
  454. for(H=1,4){EGP2:egpClear() }
  455. holoColor(21,vec(0))
  456.  
  457. }
  458.  
  459. for(B=1,8){  
  460.     if(Driver){ holoColor(55+B,Blue)
  461.     }else{ holoColor(55+B,vec(0)) }
  462. }
  463.    
  464.    
  465.     #---[Hover Light]---#
  466. #ifdef lightCreate(number,vector)
  467.    
  468.     if(Driver){
  469.    
  470.     lightCreate(1,holoEntity(58):pos()+vec(0,0,-10))
  471.     lightParent(1,holoEntity(58))
  472.     lightColor(1,Blue)
  473.     lightBrightness(1,5)
  474.     lightDistance(1,70)
  475.    
  476.     }else{ lightRemoveAll() }
  477.    
  478. #endif
  479.  
  480.     #---[Function Load]---#
  481.  
  482.  
  483.     setupEntity(Seat,E:toWorld(vec(14,10,0)),E:toWorld(ang(0,180,0)),E)
  484.     setupEntity(Seat2,E:toWorld(vec(-14,10,0)),E:toWorld(ang(0,180,0)),E)
  485.     setupEntity(EGP,E:toWorld(vec(0,-30,-10)),E:toWorld(ang(0,180,0)),E)                                                                
  486.  
  487.     Lamp1:setupLamp(holoEntity(70):toWorld(vec(-25,-36,0)),holoEntity(70):toWorld(ang(0,-115,0)),holoEntity(70))
  488.     Lamp2:setupLamp(holoEntity(71):toWorld(vec(-25,-36,0)),holoEntity(71):toWorld(ang(0,-115,0)),holoEntity(71))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top