Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 61.72 KB | None | 0 0
  1. -- NeuroNaval Global by Robin Hoffa
  2. resource.AddFile("materials/vgui/ui")
  3.  
  4. local Meta = FindMetaTable("Entity")
  5. -- function GAMEMODE:PlayerFootstep( ply, pos, foot, sound, volume, filter )
  6.    
  7.     -- return !IsValid( ply:GetScriptedVehicle() )
  8.    
  9. -- end
  10. concommand.Add("name_ship", function( ply, cmd, args )
  11.    
  12.     if( IsValid( ply ) ) then
  13.         local veh = ply:GetScriptedVehicle()
  14.         if( IsValid( veh ) && veh.IsMicroCruiser && !veh.ShipName ) then
  15.          
  16.             veh.ShipName = string.sub( args[1], 1, 32 )
  17.             -- print( ply:Name().." named his "..veh.PrintName.." "..veh.ShipName, ply, veh )
  18.             veh:SetNWString("ShipName", veh.ShipName )
  19.        
  20.         end
  21.        
  22.     end
  23.  
  24. end )
  25. concommand.Add("_neuronaval_zoomvalue", function( ply,cmd,args )
  26.     -- print("walla?")
  27.     -- print( args[1] )
  28.     if( tonumber( args[1] ) != nil ) then
  29.        
  30.         ply.zoomValue = math.Clamp(  tonumber( args[1] ), 5, 90 )
  31.    
  32.     end
  33.  
  34. end )
  35.  
  36.  
  37.  
  38. function Meta:NeuroNaval_DefaultPhysicsUpdate()
  39.  
  40.  
  41. end
  42.  
  43.  
  44. function Meta:NeuroNaval_DefaultPhysSimulate( phys, deltatime )
  45.         -- print("lahme?")
  46.     phys:Wake()
  47.     -- phys:AddAngleVelocity(Vector( math.cos(CurTime())*.1, math.sin(CurTime())*.1,  0) )
  48.     if( IsValid( self.Deck ) ) then
  49.        
  50.         self.Deck:GetPhysicsObject():AddAngleVelocity(Vector( math.cos(CurTime())*.01, math.sin(CurTime())*.01,  0) )
  51.          
  52.     end
  53.    
  54.     if( self.ShipAngleForceCurrentValue && self.ShipAngleForceTargetValue ) then
  55.    
  56.         self.ShipAngleForceCurrentValue = math.Approach( self.ShipAngleForceCurrentValue, self.ShipAngleForceTargetValue, 0.0151 )
  57.         --self.ShipAngleForceCurrentValue*50
  58.         local dir = -1
  59.         if( self.ActualSpeed < 0 ) then
  60.              dir = 1
  61.         end
  62.         local sforce = math.cos(CurTime()+self:EntIndex())*.01
  63.         local sforce2 =  0 --dir*.00021+math.sin(CurTime()*.1)*(math.Clamp(self:GetVelocity():Length(),0,100 )/100)
  64.         if( !self.IsMicroCruiser ) then
  65.             sforce = 0
  66.             sforce2 = 0
  67.            
  68.         end
  69.         if( !self.SAFApproachVal ) then
  70.            
  71.             self.SAFApproachVal = 0
  72.            
  73.         end
  74.         local myang = self:GetAngles()
  75.        
  76.         self.SAFApproachVal = Lerp( 0.1225, self.SAFApproachVal, self.ShipAngleForceCurrentValue * ( self.TurnAngleValue or 5 ) )
  77.         if( myang.r < 45 && myang.r > -45 && self.PropellerPos && !self.RudderIsFucked  ) then
  78.             -- print("what")
  79.             self.PhysObj:ApplyForceOffset( self:GetRight() * ( self.ShipAngleForceCurrentValue * ( self.TurnForceValue or 54000 ) ), self:LocalToWorld( self.PropellerPos )  )
  80.             self.PhysObj:AddAngleVelocity( Vector( sforce, -self.ActualSpeed*( self.PitchForce or .001 ) + math.sin(CurTime())/(self.PitchSineValue or 2), 0 ) )
  81.        
  82.         else
  83.        
  84.        
  85.             self.ShipAngleForce = Vector(sforce, sforce2, self.ShipAngleForceCurrentValue )
  86.             self.PhysObj:AddAngleVelocity( self.ShipAngleForce )  
  87.        
  88.         end
  89.        
  90.         self.PhysObj:AddAngleVelocity( Vector( self.SAFApproachVal, 0,0 ) )
  91.         self.Speed = math.Clamp( self.Speed, self.MinVelocity, self.MaxVelocity )
  92.         -- print( self.Speed/self.MaxVelocity )
  93.         if( self.Speed < 0 ) then
  94.            
  95.             self:SetNWFloat( "Throttle", self.Speed/self.MinVelocity )
  96.            
  97.         else
  98.        
  99.             self:SetNWFloat( "Throttle", self.Speed/self.MaxVelocity )
  100.        
  101.         end
  102.        
  103.         self:SetNWFloat("ActualSpeed", self.Speed )
  104.        
  105.         if( self.IsMicroCruiser ) then
  106.        
  107.             -- self:GetPhysicsObject():ApplyForceCenter( self:GetForward() * ( self.Speed * 500 ) )
  108.             -- self:GetPhysicsObject():AddAngleVelocity( self:GetForward() * math.sin(CurTime()*.001)*2.5 )
  109.            
  110.         end
  111.        
  112.        
  113.         self.ActualSpeed = math.Approach( self.ActualSpeed, self.Speed, self.ThrottleIncrementSize or 1 )
  114.         -- print( self.ActualSpeed )
  115.        
  116.         if( self.PropellerPos  ) then
  117.        
  118.             self.PhysObj:ApplyForceOffset( self:GetForward() * ( self.ActualSpeed * 120 ), self:LocalToWorld( self.PropellerPos ) )
  119.        
  120.         else
  121.        
  122.             self:GetPhysicsObject():ApplyForceCenter( self:GetForward() * ( self.ActualSpeed * 120 ) )
  123.        
  124.         end
  125.        
  126.     end
  127.    
  128.     -- if( !IsValid( self.Pilot ) ) then return end
  129.    
  130.     self.PhysObj:SetBuoyancyRatio( self.BuoyancyRatio )
  131.    
  132.    
  133.    
  134.     if( self.HasDeck && !IsValid( self.Deck ) ) then return end -- citadel broken, tfw no controls
  135.    
  136.     if ( self.IsBoating && self:WaterLevel() > 0 && !self.Destroyed ) then
  137.  
  138.         local p = { { Key = IN_FORWARD, Speed = self.ForwardSpeed, Velocity = self.MaxVelocity };
  139.                     { Key = IN_BACK, Speed = self.ReverseSpeed, Velocity = self.MinVelocity }; }
  140.         if( IsValid( self.Pilot ) && !self.Pilot.LastThrottleMovement ) then
  141.            
  142.             self.Pilot.LastThrottleMovement = CurTime()
  143.            
  144.         end
  145.        
  146.         for k,v in ipairs( p ) do
  147.            
  148.             if ( IsValid( self.Pilot ) && self.Pilot:KeyDown( v.Key ) && self.Pilot.LastThrottleMovement + 1.0 <= CurTime() ) then
  149.            
  150.                 self.Pilot.LastThrottleMovement = CurTime()
  151.                
  152.                 self.Speed = math.Approach( self.Speed, v.Velocity, v.Speed )
  153.                
  154.            
  155.             else
  156.            
  157.                 -- self.Speed = math.Approach( self.Speed, 0, 0.25   ) //Stop the ship after releasing the key.
  158.            
  159.             end
  160.            
  161.         end
  162.        
  163.         self.LastChadburn = self.LastChadburn or 0
  164.        
  165.         if( self.LastChadburn != self.Speed && !self.Pilot:KeyDown( IN_FORWARD ) && !self.Pilot:KeyDown( IN_BACK ) ) then
  166.            
  167.             self.LastChadburn = self.Speed
  168.             -- print( self.Speed )
  169.             if( self.Speed == self.MaxVelocity || self.Speed == self.MinVelocity ) then
  170.                
  171.                 self:EmitSound( ( self.ChadburnSound or "chadburn/cb1.wav" ), 511, 100 )
  172.            
  173.             else           
  174.                
  175.                 self:EmitSound( ( self.ChadburnSoundFast or "chadburn/cb2.wav" ), 511, 100 )
  176.            
  177.             end
  178.            
  179.        
  180.         end
  181.            
  182.         local t = { { Key = IN_MOVERIGHT, Speed = 0.0051 }; { Key = IN_MOVELEFT, Speed = -0.0051 } }
  183.         -- local keydown = false
  184.         for k,v in ipairs( t ) do
  185.            
  186.             if(  IsValid( self.Pilot ) && self.Pilot:KeyDown( v.Key ) ) then
  187.                
  188.                 local mult = 1
  189.                 if( self.WonkyHull ) then
  190.                    
  191.                     mult = 100
  192.                    
  193.                 end
  194.                
  195.                 if( self.CanTurnStationary ) then
  196.                    
  197.                     self.ShipAngleForceTargetValue = -v.Speed*25/self.TurnModifierValue * mult
  198.                     -- self.PhysObj:AddAngleVelocity( Vector( self.TurnModifierValue/2, 0,  ) )                
  199.                    
  200.                     -- print( -v.Speed*25/self.TurnModifierValue )
  201.                 else
  202.                
  203.                     self.ShipAngleForceTargetValue = -v.Speed/self.TurnModifierValue
  204.                     -- self.PhysObj:AddAngleVelocity( Vector( self.TurnModifierValue*2, 0, -v.Speed/self.TurnModifierValue ) )
  205.                    
  206.                 end
  207.                
  208.                 self.PhysObj:ApplyForceCenter( self:GetRight() * ( v.Speed * ( self:GetPhysicsObject():GetMass() *  10 ) ) )
  209.                
  210.                 break
  211.            
  212.             else
  213.                
  214.                 self.ShipAngleForceTargetValue = 0
  215.                
  216.             end
  217.        
  218.         end
  219.  
  220.        
  221.            
  222.     end
  223.  
  224. end
  225.  
  226. util.AddNetworkString( "NeuroNavalAmmoCount" )
  227. util.AddNetworkString( "NeuroNavalAmmoCountSingle" )
  228.  
  229. function SendBoatWeaponsSingle( boat, idx, count )
  230.    
  231.     if( !IsValid( boat ) ) then return end
  232.    
  233.     local pilot = boat.Pilot
  234.     if( !IsValid( pilot ) ) then return end
  235.    
  236.     net.Start("NeuroNavalAmmoCountSingle") 
  237.     -- for k,v in pairs( self.Weaponry ) do
  238.     net.WriteInt( idx, 16 )
  239.     net.WriteInt( count, 16 )
  240.     -- end
  241.     net.Send( pilot )
  242.    
  243. end
  244. function SendBoatWeapons( boat )
  245.    
  246.     if( !IsValid( boat ) ) then return end
  247.     if( !boat.Weaponry  ) then return end
  248.    
  249.     local pilot = boat.Pilot
  250.     if( !IsValid( pilot ) ) then return end
  251.    
  252.     net.Start("NeuroNavalAmmoCount")   
  253.     for k,v in pairs(  boat.Weaponry ) do
  254.         net.WriteInt( k, 16 )
  255.         net.WriteInt( v.AmmoCounter, 16 )
  256.     end
  257.     net.Send( pilot )
  258.    
  259. end
  260.  
  261. util.AddNetworkString( "NeuroNavalCooldown" )
  262.  
  263. function Meta:NavalSendWeaponCooldown( idx, count )
  264.    
  265.     if( IsValid( self.Pilot ) ) then
  266.        
  267.         net.Start("NeuroNavalCooldown")
  268.             net.WriteInt( idx, 16 )
  269.             net.WriteInt( count, 16 )
  270.         net.Send( self.Pilot )
  271.    
  272.    
  273.     end
  274.  
  275. end
  276. util.AddNetworkString( "NeuroNavalWeapons" )
  277. -- Print Glorified SendTable lol
  278. function Meta:NavalSendWeaponEntities( ply )
  279.    
  280.     if( IsValid( ply ) && self.Weaponry ) then
  281.        
  282.         local Weps = {}
  283.         for k,v in pairs( self.Weaponry ) do
  284.            
  285.             if( IsValid( v.Turret ) ) then
  286.                
  287.                 table.insert( Weps, v.Turret )
  288.                
  289.             end
  290.            
  291.         end
  292.         -- print("begin network")
  293.         -- PrintTable( Weps )
  294.         net.Start("NeuroNavalWeapons")
  295.             net.WriteInt( #Weps, 32 ) -- write size of table so we know how big the loop on the client must be
  296.             for i=1,#Weps do
  297.                 net.WriteEntity( Weps[i] )
  298.                
  299.             end
  300.        
  301.         net.Send( ply )
  302.    
  303.    
  304.     end
  305.  
  306. end
  307.  
  308. function Meta:NeuroNaval_DefaultCruiserThink()
  309.     -- print(self:GetClass(), self:WaterLevel() )
  310.     if( self:WaterLevel() < 3 ) then
  311.    
  312.         if( self.DamagedPoints && #self.DamagedPoints > 0 ) then
  313.            
  314.             for i=1,#self.DamagedPoints do
  315.            
  316.                 local effectdata = EffectData()
  317.                 effectdata:SetOrigin( self:LocalToWorld( self.DamagedPoints[i] ) )
  318.                 if( self.IsMicroCruiser ) then
  319.                    
  320.                     effectdata:SetScale( .5 )
  321.                    
  322.                 end
  323.                
  324.                 self.HealthVal = self.HealthVal - math.random(1,2)
  325.                
  326.                 util.Effect( "immolate", effectdata )
  327.  
  328.             end
  329.        
  330.         end
  331.        
  332.     end
  333.     local myang = self:GetAngles()
  334.    
  335.     if( myang.r > 45 || myang.r < -45 ) then
  336.        
  337.         self.BuoyancyRatio = self.BuoyancyRatio * .999
  338.    
  339.     end
  340.    
  341.     -- wallaaa
  342.     if( self.HasNPCAntiAir ) then
  343.        
  344.         if( !IsValid( self.Target ) ) then
  345.    
  346.             local closest = NULL
  347.             local dist = 5555
  348.            
  349.             for k,v in ipairs( player.GetAll() ) do
  350.                
  351.                 local distdiff = ( self:GetPos() - v:GetPos() ):Length()
  352.                 local cl = v:GetClass()
  353.                 if( distdiff < dist  && v:GetVelocity():Length() > 700 && v != self.Owner.Pilot ) then
  354.                     local target = v
  355.                     if( IsValid( v:GetScriptedVehicle() ) ) then
  356.                        
  357.                         target = v:GetScriptedVehicle()
  358.                        
  359.                     end
  360.                    
  361.                     if( v:GetPos().z > self:GetPos().z + 250 && neuro_inLOS( self, target  ) ) then                    
  362.                        
  363.                         dist = distdiff  
  364.                         closest = v
  365.                        
  366.                     end
  367.                    
  368.                    
  369.                 end
  370.            
  371.            
  372.             end
  373.            
  374.             if( IsValid( closest ) ) then
  375.            
  376.                 self.Target = closest
  377.  
  378.                 return
  379.                
  380.             end
  381.        
  382.         end
  383.    
  384.     end
  385.    
  386.    
  387.     if( self.PropellerPosition && self:WaterLevel() > 0 && self.Speed > 15 ) then
  388.        
  389.         local fx = EffectData()
  390.         fx:SetOrigin( self:LocalToWorld( self.PropellerPosition) )
  391.         fx:SetScale(  self.PropellerSplashSize  )
  392.         util.Effect("waterripple", fx )
  393.        
  394.     end
  395.  
  396.     if ( self.Destroyed ) then
  397.        
  398.         -- print("what in the b")
  399.         if( IsValid( self.Pilot ) ) then
  400.        
  401.             self:EjectCaptain()
  402.            
  403.         end
  404.        
  405.         if( !self.IsBurning ) then
  406.        
  407.             self.IsBurning = true
  408.             ParticleEffectAttach( "fire_b", PATTACH_ABSORIGIN_FOLLOW, self, 0 )
  409.            
  410.         end
  411.  
  412.         self.DeathTimer = self.DeathTimer + 1
  413.         self.BuoyancyRatio = self.BuoyancyRatio * ( self.SinkRate or .99 )
  414.         self:GetPhysicsObject():SetBuoyancyRatio( self.BuoyancyRatio )
  415.         -- self:SetAngles( LerpAngle( .1, self:GetAngles(), self.FuckedUpAngle ) )
  416.        
  417.        
  418.         if( !self.IsMicroCruiser && self:WaterLevel() < 2 ) then
  419.             if( math.random( 1, 15 ) == 2 ) then
  420.                
  421.                 ParticleEffect( "HE_impact_wall", self:GetPos(), Angle(0,0,0), nil )
  422.                 util.BlastDamage( self, self, self:GetPos(), 1628, 15 )
  423.                
  424.             end
  425.             local effectdata = EffectData()
  426.             effectdata:SetOrigin( self:GetPos() + self:GetRight() * math.random(-62,62) + self:GetForward() * math.random(-62,62)  )
  427.             util.Effect( "immolate", effectdata )
  428.             -- self:GetPhysicsObject():SetDamping( 5000.0, 5000.0 )
  429.         end
  430.         -- if(  !self.MassiveFire && !self.IsMicroCruiser ) then
  431.            
  432.             -- self.MassiveFire = true
  433.             -- ParticleEffectAttach( "fireplume", PATTACH_ABSORIGIN, self, 0 ) -- big fire
  434.    
  435.                
  436.         -- end
  437.         if( !self.MicroFire && self.IsMicroCruiser ) then
  438.            
  439.             self.MicroFire = true
  440.             ParticleEffectAttach( "fireplume_small", PATTACH_ABSORIGIN, self, 0 ) -- big fire
  441.             local LastDamagePos = self.LastDamagePosition or self:GetPos() + self:GetRight() * math.random(-125,125) + self:GetForward() * math.random(-252,252 )
  442.             local imbalance = ents.Create("prop_physics")
  443.             imbalance:SetPos( LastDamagePos )
  444.             imbalance:SetAngles( self:GetAngles() )
  445.             imbalance:SetModel("models/props_c17/concrete_barrier001a.mdl")
  446.             imbalance:Spawn()
  447.             imbalance:SetNoDraw( true )
  448.             imbalance:GetPhysicsObject():SetMass( self:GetPhysicsObject():GetMass() * .1 )
  449.             self:GetPhysicsObject():SetDamping( 10, 15 )
  450.             timer.Create( "ship_imbalance_"..imbalance:EntIndex(), .1, 500, function()
  451.                
  452.                 if( IsValid( imbalance ) ) then
  453.                
  454.                     imbalance:GetPhysicsObject():SetMass( imbalance:GetPhysicsObject():GetMass() * 1.0215 )
  455.                    
  456.                 end
  457.  
  458.             end )          
  459.             constraint.Weld( imbalance, self, 0,0,0, true, false )
  460.             self:DeleteOnRemove( imbalance )
  461.            
  462.             if( IsValid( self.KeepUp ) ) then self.KeepUp:Remove() end
  463.             -- self.BuoyancyRatio = self.BuoyancyRatio * 1.5
  464.             -- self:GetPhysicsObject():SetBuoyancyRatio( self.BuoyancyRatio )
  465.    
  466.         end
  467.        
  468.         if( self.MicroSpectactularDeath && self.DeathTimer > 75  && !self.Fucked ) then
  469.        
  470.             ParticleEffect("water_impact_big", self:GetPos() + self:GetUp() * 1, Angle(0,0,0), nil )
  471.             self.Shake = ents.Create( "env_shake" )
  472.             self.Shake:SetOwner( self )
  473.             self.Shake:SetPos( self:GetPos() )
  474.             self.Shake:SetKeyValue( "amplitude", "500" )    -- Power of the shake
  475.             self.Shake:SetKeyValue( "radius", "9500" )  -- Radius of the shake
  476.             self.Shake:SetKeyValue( "duration", "5" )   -- Time of shake
  477.             self.Shake:SetKeyValue( "frequency", "255" )    -- How har should the screenshake be
  478.             self.Shake:SetKeyValue( "spawnflags", "4" ) -- Spawnflags( In Air )
  479.             self.Shake:Spawn()
  480.             self.Shake:Activate()
  481.             self.Shake:Fire( "StartShake", "", 0 )
  482.             util.BlastDamage( self, self, self:GetPos()+Vector(0,0,2504), 1024, 25000 )
  483.             self:PlayWorldSound( "ambient/athmosphere/thunder2.wav")
  484.             self:PlayWorldSound( "ambient/explosions/explode_7.wav")
  485.             self:GetPhysicsObject():SetBuoyancyRatio( 0 )
  486.             self:SetColor( Color( 155,155,155,255 ) )
  487.             self:Fire("kill","",10 )
  488.                             -- self.BuoyancyRatio = self.BuoyancyRatio * 1.5
  489.             -- self:GetPhysicsObject():SetBuoyancyRatio( self.BuoyancyRatio )
  490.             self.Fucked = true
  491.            
  492.             return
  493.            
  494.         end
  495.        
  496.         if( self.SpectactularDeath ) then
  497.            
  498.        
  499.            
  500.             if( self.DeathTimer > 50  && !self.Fucked ) then
  501.            
  502.            
  503.                 ParticleEffect("fireball_explosion", self:GetPos() + self:GetUp() * 1, Angle(0,0,0), nil )
  504.            
  505.                 -- ParticleEffect("V1_impact", self:GetPos() + self:GetUp() * 700, Angle(0,0,0), nil )
  506.                 self.Shake = ents.Create( "env_shake" )
  507.                 self.Shake:SetOwner( self )
  508.                 self.Shake:SetPos( self:GetPos() )
  509.                 -- self.Shake:SetParent( self )
  510.                 self.Shake:SetKeyValue( "amplitude", "500" )    -- Power of the shake
  511.                 self.Shake:SetKeyValue( "radius", "9500" )  -- Radius of the shake
  512.                 self.Shake:SetKeyValue( "duration", "5" )   -- Time of shake
  513.                 self.Shake:SetKeyValue( "frequency", "255" )    -- How har should the screenshake be
  514.                 self.Shake:SetKeyValue( "spawnflags", "4" ) -- Spawnflags( In Air )
  515.                 self.Shake:Spawn()
  516.                 self.Shake:Activate()
  517.                 self.Shake:Fire( "StartShake", "", 0 )
  518.                 util.BlastDamage( self, self, self:GetPos()+Vector(0,0,2504), 1024, 25000 )
  519.                 self:PlayWorldSound( "ambient/athmosphere/thunder2.wav")
  520.                 self:PlayWorldSound( "ambient/explosions/explode_7.wav")
  521.                 self:GetPhysicsObject():SetBuoyancyRatio( 0 )
  522.                 self:SetColor( Color( 55,55,55,255 ) )
  523.                 self:Fire("kill","",5 )
  524.                
  525.                 self.Fucked = true
  526.                
  527.                 return
  528.                
  529.             end
  530.            
  531.         end
  532.        
  533.         if self.DeathTimer > 100 then
  534.        
  535.            
  536.             self.BuoyancyRatio = 0.0
  537.             self:Remove()
  538.            
  539.         end
  540.        
  541.         self:NextThink( CurTime() + 0.2 )
  542.        
  543.         return
  544.        
  545.     end
  546.    
  547.     if ( self.NeuroNaval_HasMissileJammer ) then
  548.    
  549.         self:NeurNaval_MissileJammer()
  550.    
  551.     end
  552.     if ( self.Cannons != nil ) then
  553.        
  554.         for k,v in pairs( self.Cannons ) do
  555.            
  556.             if( IsValid( v )  ) then
  557.            
  558.                 v:GetPhysicsObject():Wake()
  559.            
  560.             end
  561.            
  562.         end
  563.    
  564.    
  565.     end
  566.     if ( self.IsBoating && IsValid( self.Pilot ) ) then
  567.        
  568.         local vel = self:GetVelocity():Length()
  569.        
  570.         -- self.EngineSound:ChangePitch( math.Clamp( 90 + ( vel / 30 ), 90, 155 ), 0.1 )
  571.         self:SetNWFloat("BoostPercentage",  self.ActualSpeed / self.MaxVelocity )
  572.         self.EngineSound:ChangeVolume( math.abs( 1.0 * self.ActualSpeed / self.MaxVelocity ))
  573.         self.WaterSound:ChangeVolume( math.abs(1.0 * self.ActualSpeed / self.MaxVelocity ))
  574.        
  575.        
  576.        
  577.         if( self.Pilot == NULL ) then return end
  578.        
  579.         -- self.Pilot:SetPos( self:GetPos() + self:GetUp() * 120 )
  580.        
  581.         if( self.Pilot:KeyDown( IN_USE ) && self.LastUse + 0.95  <= CurTime() ) then
  582.            
  583.             self:EjectCaptain()
  584.            
  585.             return
  586.            
  587.         end
  588.        
  589.         if( self.Pilot:KeyDown( IN_JUMP ) && self.LastUse + 1 <= CurTime() ) then
  590.            
  591.             local ply = self.Pilot
  592.             self.LastUse = CurTime()
  593.  
  594.             if( type( self.Cannons ) == "table" ) then
  595.            
  596.                 local found = false
  597.                 local itr = 0
  598.                
  599.                    
  600.                 while !found do
  601.                     itr = itr + 1
  602.                    
  603.                     if( itr > 25 ) then break end
  604.                    
  605.                     local r = math.random(1,#self.Cannons)
  606.                     local d = self.Cannons[r].Pilot
  607.                     if( !IsValid( d ) && self.Cannons[r].VehicleType == STATIC_GUN ) then
  608.                        
  609.                         self:EjectCaptain()
  610.            
  611.                         self.Cannons[r]:Use( ply, ply, 0, 0 )
  612.                         found = true
  613.                        
  614.                         break
  615.                        
  616.                     end
  617.                        
  618.                 end
  619.                
  620.             end
  621.            
  622.             return
  623.        
  624.         end
  625.        
  626.         if (  self.Pilot:KeyDown( IN_ATTACK2 ) && ( !self.WeaponSystems ) && self.LastAttackKeyDown + 0.5 < CurTime() ) then
  627.        
  628.             local id = self.EquipmentNames[ self.FireMode ].Identity
  629.             local wep = self.RocketVisuals[ id ]
  630.            
  631.             if ( wep.LastAttack + wep.Cooldown <= CurTime() ) then
  632.            
  633.                 self:NeuroPlanes_FireRobot( wep, id )
  634.                
  635.             else
  636.            
  637.  
  638.                 local cd = math.ceil( ( wep.LastAttack + wep.Cooldown ) - CurTime() )
  639.                
  640.                 if ( cd == 1 ) then
  641.                
  642.                     self.Pilot:PrintMessage( HUD_PRINTTALK, self.PrintName..": "..wep.PrintName.." ready in "..tostring( cd ).. " second." )
  643.                
  644.                 else
  645.                
  646.                     self.Pilot:PrintMessage( HUD_PRINTTALK, self.PrintName..": "..wep.PrintName.." ready in "..tostring( cd ).. " seconds." )  
  647.                
  648.                 end
  649.                
  650.             end
  651.            
  652.             self.LastAttackKeyDown = CurTime()
  653.  
  654.         end
  655.        
  656.         // Firemode
  657.         if ( self.EquipmentNames && self.Pilot:KeyDown( IN_RELOAD ) && self.LastFireModeChange + 0.5 <= CurTime() ) then
  658.  
  659.             self:CycleThroughWeaponsList()
  660.            
  661.         end
  662.        
  663.         if( self.HasAdvancedSAMSystem ) then
  664.                
  665.            
  666.            
  667.            
  668.            
  669.        
  670.         end
  671.        
  672.  
  673.     end
  674.    
  675.         self:NextThink( CurTime() )
  676.  
  677.     if( IsValid( self.PhysObj ) ) then
  678.    
  679.         self.PhysObj:SetBuoyancyRatio( self.BuoyancyRatio )
  680.         self.PhysObj:Wake()
  681.        
  682.     end
  683.            
  684.     return true
  685.    
  686. end
  687.  
  688. -- function Meta:FindWaterSurface( ply )
  689.    
  690.    
  691.  
  692. -- end
  693.  
  694. function Meta:CaptainHasGunsThink()
  695.     -- self:NextThink(CurTime())
  696.    
  697.     if( self.Weaponry && IsValid( self.Pilot )  && self.Pilot.SelectedWeapon ) then
  698.         local sameType = -1
  699.        
  700.         for k,v in pairs( self.Weaponry ) do
  701.                    
  702.             -- local k = self.Pilot.SelectedWeapon
  703.             -- local v = self.Weaponry[k]
  704.             -- print( self.Pilot.SelectedWeapon )
  705.             -- print( v.WeaponGroup )
  706.             if ( v.WeaponGroup == self.Pilot.SelectedWeapon && IsValid( v.Turret ) && !v.Destroyed ) then
  707.                 -- print("eh?")
  708.                 local tr1,trace1 = {},{}
  709.                 tr1.start = self:GetPos()
  710.                 tr1.endpos = tr1.start+ self:GetUp() * self.CamUp + self.Pilot:GetAimVector() * -self.CamDist
  711.                 tr1.filter = { self, self.Pilot }
  712.                 tr1.mask = MASK_SOLID_BRUSHONLY
  713.                 trace1 = util.TraceLine ( tr1 )
  714.                
  715.                 local pos = trace1.HitPos + trace1.HitNormal * 8
  716.                 if( pos.z < self:GetPos().z+350 ) then pos.z = self:GetPos().z + self.CameraMinZ or 350 end
  717.                
  718.                 if( self.Pilot.zoomValue ) then
  719.                
  720.                     pos.z = pos.z + ( 90 / self.Pilot.zoomValue )*11.5
  721.                
  722.                 end
  723.                
  724.                 self.Pilot:SetPos( pos )   
  725.                
  726.                 local tr, trace = {},{}
  727.                 trace.start =  self.Pilot:GetShootPos()
  728.                 trace.endpos = trace.start + self.Pilot:GetAimVector() * 44000
  729.                 trace.filter = { self, v.Turret, v.Barrel, self.Deck }
  730.                 trace.mask = MASK_SOLID + MASK_WATER
  731.                 tr = util.TraceLine( trace )
  732.                 if( trace.Hit && IsValid( trace.Entity ) ) then
  733.                    
  734.                     self.TraceTarget = trace.Entity
  735.                     self.LastTraceTargetHit = CurTime()
  736.                    
  737.                
  738.                 end
  739.                 -- self:DrawLaserTracer( trace.start, tr.HitPos )
  740.                 -- debugoverlay.Line( tr.HitPos, tr.HitPos + Vector(0,0,500), 2.1, Color( 255,0,0,255 ), true  )
  741.                 if( !self.Pilot:KeyDown( IN_ATTACK2 ) ) then
  742.                
  743.                     self.Pilot.ClientVector = tr.HitPos
  744.                    
  745.                 end
  746.                
  747.                 local hpos = self.Pilot.ClientVector
  748.                 if( !self.Pilot.LastSync ) then self.Pilot.LastSync = CurTime() end
  749.                
  750.                 if( self.Pilot.LastSync && self.Pilot.LastSync + 0.05 <= CurTime() ) then
  751.                    
  752.                     self.Pilot.LastSync = CurTime()
  753.                     self.Pilot:SetNWVector("_NNHPOS", hpos )
  754.                    
  755.                 end
  756.                 -- if( self.IPPCorrectionalZVector ) then
  757.            
  758.                     -- hpos.z = hpos.z + ( self:GetPos().z - v.Base:GetPos().z)*2
  759.                    
  760.                 -- end
  761.                 -- debugoverlay.Sphere( hpos, 28, 0.1,Color(0,255,0,255 ), true )
  762.                
  763.                 local dist = ( trace.start - hpos ):Length()
  764.  
  765.                 -- if( tr.Fraction > 0.000021 ) then  
  766.                
  767.                 local TargetPos = hpos
  768.                 local ta = ( v.Turret:GetPos() - TargetPos ):Angle()
  769.                 local ma = self:GetAngles()
  770.                 local offs = self:VecAngD( ma.y, ta.y )
  771.                 local TargetAngle = -offs + 180
  772.                 local towerang = v.Turret:GetAngles()
  773.                 local diff = self:VecAngD( towerang.y, ta.y )
  774.                 local angg = self:GetAngles()
  775.                 local maxpitch = self.MaxBarrelPitch or 55
  776.                 local minpitch = self.MinBarrelPitch or 25
  777.                 local turretAng = v.Turret:GetAngles()
  778.                
  779.                 -- v.Turret.MaxRange = self.MaxRange
  780.                 -- v.Turret.MinRange = self.MinRange
  781.                 self.Barrel = v.Barrel
  782.                 self.BarrelLength = v.BarrelLength
  783.                
  784.                 local theta =  math.Clamp( self:BallisticCalculation( hpos ), turretAng.p-maxpitch, turretAng.p+17.5 )
  785.                 if( v.DisableIPP ) then
  786.                    
  787.                     theta = math.Clamp( self.Pilot:EyeAngles().p-2, -65, -7 )
  788.                
  789.                 end
  790.                 -- local ctr,ctrace ={},{}
  791.                
  792.                 -- if( v.UseHitScan ) then
  793.                    
  794.                     -- theta = -ta.p
  795.                    
  796.                 -- end
  797.                
  798.                 -- print ( theta, self:BallisticCalculation( hpos ) )
  799.                 angg:RotateAroundAxis( self:GetUp(), TargetAngle )
  800.                 local extra = 0
  801.                 local extrap = 0
  802.                 if( v.TAng ) then
  803.                     extra = v.TAng.y
  804.                     extrap = v.TAng.p
  805.                    
  806.                 end
  807.                
  808.                     -- print( v.TAng )
  809.                 local newDiff = math.AngleDifference( ma.y+extra, angg.y )
  810.                 -- print( newDiff )
  811.                 v.AngDiff = newDiff
  812.                
  813.                 if( v.AngDiff > -v.MaxYaw && v.AngDiff < v.MaxYaw ) then
  814.                    
  815.                     local lerpvalue = v.TowerTurnSpeed
  816.                     v.Barrel:SetNWInt("BarrelTheta",theta )
  817.                     v.Turret:SetNWFloat("TowerYaw", angg.y )
  818.                     -- if( !v.DontPitchBarrel ) then
  819.                    
  820.                     v.Turret:SetAngles( LerpAngle( FrameTime()*lerpvalue, towerang, angg ) )
  821.                        
  822.                     -- end
  823.                    
  824.                     local ba = v.Turret:GetAngles()
  825.                     if( !v.DontAnimateBarrel ) then
  826.                    
  827.                         v.Barrel:SetAngles( Angle( Lerp(  FrameTime()*lerpvalue, v.Barrel:GetAngles().p, theta), ba.y, ba.r  ) )
  828.                    
  829.                     end
  830.                    
  831.                 end
  832.                
  833.             end
  834.            
  835.         end
  836.        
  837.         if( self.LastAttackKeyDown && self.LastAttackKeyDown + .1 <= CurTime() ) then  
  838.            
  839.             self.LastAttackKeyDown  = CurTime()
  840.            
  841.             local hpos = self.Pilot.ClientVector
  842.             for k,v in pairs( self.Weaponry ) do
  843.                
  844.                 if ( v.WeaponGroup == self.Pilot.SelectedWeapon && IsValid( v.Turret ) && !v.Destroyed && v.AmmoCounter > 0 ) then
  845.                     -- print( k, v.LastAttack, v.LastAttack + v.Cooldown <= CurTime() )
  846.                     -- print(k)
  847.                     if( v.LastAttack + v.Cooldown >= CurTime() ) then continue end
  848.                    
  849.                     if ( v.AngDiff && v.AngDiff > -v.MaxYaw && v.AngDiff < v.MaxYaw &&  self.Pilot:KeyDown( IN_ATTACK ) ) then
  850.                            
  851.                             local numshots = v.NumShots or #v.BarrelPorts
  852.                             if( numshots == 1 ) then
  853.                                
  854.                                 v.AmmoCounter = v.AmmoCounter - 1
  855.                                 self:NavalSendWeaponCooldown( k, v.AmmoCounter )
  856.                                
  857.                                 self:YamatoFire( v, 1, k, hpos   )
  858.                                 v.LastAttack = CurTime()
  859.                                 -- self.LastAttackKeyDown = CurTime()
  860.                                
  861.                                 if( v.Cooldown >= 2.5 ) then
  862.                                        
  863.                                     timer.Simple( v.Cooldown, function()
  864.                                        
  865.                                         if( IsValid( self ) && IsValid( self.Pilot ) ) then
  866.                                            
  867.                                             self.Pilot:SendLua("HitMarker([["..v.Name.." is ready!]])")
  868.                                        
  869.                                        
  870.                                         end
  871.                                    
  872.                                     end )
  873.                                
  874.                                 end
  875.                                 if( v.Cooldown > .25 ) then
  876.                                
  877.                                     break
  878.                                
  879.                                 end
  880.                                
  881.                             else
  882.  
  883.                                 if( self.GroupShotCounter < numshots ) then
  884.        
  885.                                     if( self.GroupShotCooldown && self.GroupShotCooldown + .15 >= CurTime() ) then continue end
  886.                                    
  887.                                     self.GroupShotCounter = self.GroupShotCounter + 1
  888.                                     self.GroupShotCooldown = CurTime()
  889.                                        
  890.                                     if( IsValid( self )  ) then
  891.                                    
  892.                                         v.AmmoCounter = v.AmmoCounter - 1
  893.                                    
  894.                                         self:YamatoFire( v, self.GroupShotCounter, k, hpos   )
  895.                                        
  896.                                     end
  897.                                    
  898.                                     break
  899.                                    
  900.                                 else
  901.                                    
  902.                                     v.LastAttack = CurTime()
  903.                                     v.AmmoCounter = v.AmmoCounter - 1
  904.                                     self:NavalSendWeaponCooldown( k, v.AmmoCounter )
  905.                                    
  906.                                     self.LastAttackKeyDown = CurTime()
  907.                                     self.GroupShotCounter = 0
  908.                                     -- print("walla?")     
  909.                                     if( v.Cooldown >= 2.5 ) then
  910.                                            
  911.                                         timer.Simple( v.Cooldown, function()
  912.                                            
  913.                                             if( IsValid( self ) && IsValid( self.Pilot ) ) then
  914.                                                
  915.                                                 self.Pilot:SendLua("HitMarker([["..v.Name.." is ready!]])")
  916.                                            
  917.                                            
  918.                                             end
  919.                                        
  920.                                         end )
  921.                                    
  922.                                     end
  923.                        
  924.                                     break  
  925.                                
  926.                                 end
  927.                                
  928.                             end
  929.  
  930.                         -- end
  931.                        
  932.                         -- break
  933.                        
  934.                    
  935.                     end
  936.                
  937.                 end
  938.            
  939.            
  940.             end
  941.        
  942.         end
  943.        
  944.     end
  945.    
  946. end
  947.  
  948. function Meta:MicroShipGunFire( wep, idx, lastidx, targetpos  )
  949.     -- self.Pilot:PrintMessage( HUD_PRINTCENTER, lastidx )
  950.     local pos = wep.Barrel:GetPos() + wep.Barrel:GetForward() * ( wep.BarrelLength * 3)
  951.     local numshots = wep.NumShots or #wep.BarrelPorts
  952.    
  953.     if( wep.BarrelPorts ) then  
  954.         pos = wep.Barrel:LocalToWorld( wep.BarrelPorts[idx] )
  955.     end
  956.    
  957.     local bullet = {}
  958.     bullet.Num      = 1
  959.     bullet.Src      = pos
  960.     bullet.Dir      = wep.Barrel:GetAngles():Forward()
  961.     bullet.Spread   = math.Rand(-1,1) * Vector( .01531, .01531, .015  )
  962.     bullet.Tracer   = 1
  963.     bullet.Force    = 5
  964.     bullet.Damage   = math.random(wep.Damage*.7,wep.Damage)
  965.     bullet.AmmoType = "Ar2"
  966.     bullet.TracerName   = "AR2Tracer"
  967.     bullet.Attacker = self.Pilot
  968.     -- bullet.Callback    = function (a,b,c) SplodeOnImpact(self,a,b,c) end
  969.     bullet.Callback    = function ( a, b, c )
  970.                            
  971.                             local effectdata = EffectData()
  972.                                 effectdata:SetOrigin( b.HitPos )
  973.                                 effectdata:SetStart( b.HitNormal )
  974.                                 effectdata:SetNormal( b.HitNormal )
  975.                                 effectdata:SetMagnitude( 1 )
  976.                                 effectdata:SetScale( 0.75 )
  977.                                 effectdata:SetRadius( 1 )
  978.                             util.Effect( "micro_he_impact_plane", effectdata )
  979.                            
  980.                             return { damage = true, effects = DoDefaultEffect }
  981.                            
  982.                     end
  983.            
  984.     wep.Barrel:FireBullets( bullet )
  985.    
  986.     if( wep.Muzzle && wep.Muzzle != "" ) then
  987.        
  988.         ParticleEffectAttach( wep.Muzzle, PATTACH_ABSORIGIN_FOLLOW, wep.Barrel, 0 )
  989.    
  990.     end
  991.  
  992.     if( wep.ShootSound ) then
  993.         local soundEnt = wep.Barrel
  994.         if( idx == 2 ) then
  995.             soundEnt = wep.Turret
  996.         elseif( idx == 3 ) then
  997.             soundEnt = wep.Base
  998.         end
  999.        
  1000.         soundEnt:PlayWorldSound( wep.ShootSound )
  1001.         soundEnt:EmitSound( wep.ShootSound, 511, 100 )
  1002.        
  1003.         -- print("LJUD PLIS")
  1004.     end
  1005.  
  1006. end
  1007.  
  1008. function Meta:YamatoFire( wep, idx, lastidx, targetpos  )
  1009.    
  1010.     if( wep.UseHitScan ) then
  1011.    
  1012.         self:MicroShipGunFire( wep, idx, lastidx, targetpos )
  1013.    
  1014.         return
  1015.        
  1016.     end
  1017.    
  1018.     local pos = wep.Barrel:GetPos()
  1019.     local numshots = wep.NumShots or #wep.BarrelPorts
  1020.    
  1021.     if( wep.BarrelPorts ) then  
  1022.         pos = wep.Barrel:LocalToWorld( wep.BarrelPorts[idx] )
  1023.     end
  1024.    
  1025.     -- print( wep.BarrelLength )
  1026.     local shell = ents.Create( wep.AmmoType )
  1027.     shell:SetPos( pos + wep.Barrel:GetForward() * wep.BarrelLength )
  1028.  
  1029.     debugoverlay.Sphere( pos + wep.Barrel:GetForward() * wep.BarrelLength, 28, 1.1,Color(0,255,0,255 ), true )
  1030.    
  1031.     shell:SetModel( wep.AmmoModel )
  1032.     shell:SetAngles( wep.Barrel:GetAngles()  )
  1033.     shell.Owner = self.Pilot
  1034.     shell.DeployAngle = wep.Turret:GetAngles()
  1035.     shell:Spawn()
  1036.     shell.MinDamage = wep.Damage*.7
  1037.     shell.MaxDamage = wep.Damage
  1038.     shell.PenetrationDepth = wep.PenetrationDepth
  1039.     shell.Radius = wep.Radius
  1040.     shell:SetOwner( self )
  1041.     shell:GetPhysicsObject():Wake()
  1042.     shell:GetPhysicsObject():SetMass( 50 )
  1043.     shell:GetPhysicsObject():EnableDrag( true )
  1044.     shell:GetPhysicsObject():EnableGravity( true )
  1045.     shell:GetPhysicsObject():SetDamping( 0,0 )
  1046.     shell:GetPhysicsObject():SetDragCoefficient( 1.0 )
  1047.     shell.ImpactPos = targetpos
  1048.     if( wep.AmmoType != "sent_mini_torpedo" && wep.AmmoType != "sent_mini_naval_mine" && self.IPPShellVelocity || wep.ShellVelocity && wep.ShellVelocity > 500 ) then
  1049.    
  1050.         self:GetPhysicsObject():ApplyForceOffset( shell:GetForward() * -( self:GetPhysicsObject():GetMass() * ( wep.Recoil or .001  ) ), shell:GetPos() )
  1051.    
  1052.     end
  1053.    
  1054.     if( IsValid( self.TraceTarget ) && self.LastTraceTargetHit + 5 >= CurTime() ) then
  1055.        
  1056.         shell.Target = self.TraceTarget
  1057.    
  1058.     end
  1059.    
  1060.            
  1061.     if( wep.ShellVelocity ) then
  1062.            
  1063.         shell:GetPhysicsObject():SetVelocity( self:GetVelocity() + shell:GetForward() * wep.ShellVelocity )
  1064.        
  1065.     else
  1066.    
  1067.         shell:GetPhysicsObject():SetVelocity( self:GetVelocity() + self:GetVelocity() +  shell:GetForward() * self.IPPShellVelocity )
  1068.    
  1069.     end
  1070.    
  1071.     shell:Fire("kill","",60 )
  1072.     if( IsValid( self.Pilot ) && !IsValid( self.Pilot:GetNWEntity("_CINEMATIC_SHELL") ) ) then
  1073.        
  1074.         self.Pilot:SetNWEntity("_CINEMATIC_SHELL", shell )
  1075.        
  1076.     end
  1077.     -- timer.Simple( 0, function()
  1078.     -- print( shell:GetVelocity():Length() )
  1079.     -- end )
  1080.     -- shell:SetVelocity( shell:GetForward() * 700500 )
  1081.    
  1082.     -- shell:GetPhysicsObject():SetVelocity( shell:GetForward() * 500000 )
  1083.    
  1084.    
  1085.     -- print( shell:GetVelocity():Length() )
  1086.     if( wep.ShootSound ) then
  1087.         local soundEnt = wep.Barrel
  1088.         if( idx == 2 ) then
  1089.             soundEnt = wep.Turret
  1090.         elseif( idx == 3 ) then
  1091.             soundEnt = wep.Base
  1092.         end
  1093.        
  1094.         soundEnt:PlayWorldSound( wep.ShootSound )
  1095.         soundEnt:EmitSound( wep.ShootSound, 511, 100 )
  1096.         -- print("LJUD PLIS")
  1097.     end
  1098.  
  1099.         -- v.Barrel:PlayWorldSound( v.ShootSound )
  1100.         -- v.Barrel:EmitSound( v.ShootSound, 511, 100 )
  1101.  
  1102.     -- end  
  1103.                            
  1104.     if( wep.Muzzle && wep.Muzzle != "" ) then
  1105.        
  1106.         ParticleEffectAttach( wep.Muzzle, PATTACH_ABSORIGIN_FOLLOW, shell, 0 )
  1107.    
  1108.     end
  1109.    
  1110.     -- local shell =
  1111.  
  1112. end
  1113.  
  1114. function Meta:NeuroNaval_DefaultDamage( dmginfo )
  1115.  
  1116.     if( self.Destroyed ) then return end
  1117.  
  1118.     local dt = dmginfo:GetDamageType()
  1119.     local atk = dmginfo:GetAttacker()
  1120.     local dampos = dmginfo:GetDamagePosition()
  1121.     self.LastDamagePosition = dampos
  1122.     --[[/*^
  1123.     if( dt && DMG_BLAST_SURFACE == DMG_BLAST_SURFACE || dt && DMG_BLAST == DMG_BLAST || dt && DMG_BURN == DMG_BURN   ) then
  1124.         -- // Nothing, these can hurt us
  1125.     else
  1126.    
  1127.         local infomessage = "This vehicle can only be damaged by armor piercing rounds and explosives!"
  1128.        
  1129.         if( self.LastReminder + 3 <= CurTime() && atk:IsPlayer() ) then
  1130.            
  1131.             self.LastReminder = CurTime()
  1132.             atk:PrintMessage( HUD_PRINTCENTER, infomessage )
  1133.  
  1134.         end
  1135.        
  1136.         return
  1137.        
  1138.     end
  1139.     ^*/ ]]--
  1140.    
  1141.    
  1142.     local dmg = dmginfo:GetDamage()
  1143.     -- self:TakePhysicsDamage( dmginfo )
  1144.     self.HealthVal = self.HealthVal - dmg
  1145.     self:SetNWInt( "health" , self.HealthVal )
  1146.     if( self.AmmoRacks && #self.AmmoRacks > 0 ) then
  1147.        
  1148.         for k,v in pairs( self.AmmoRacks ) do
  1149.            
  1150.             if( v.Destroyed ) then continue end
  1151.             local vpos =  self:LocalToWorld( v.Pos )
  1152.             local dpos = dmginfo:GetDamagePosition()
  1153.             local dist = ( dpos - vpos ):Length()
  1154.            
  1155.             if( dist < 72 ) then
  1156.                
  1157.                 v.Health = v.Health - dmg
  1158.                 print("ouch")
  1159.             end
  1160.            
  1161.             if( v.Health <= 0 ) then
  1162.                
  1163.                 v.Destroyed = true
  1164.                 local prop = ents.Create("prop_physics_override")
  1165.                 prop:SetPos( vpos )
  1166.                 prop:SetParent( self )
  1167.                 prop:SetNoDraw( true )
  1168.                 prop:Spawn()
  1169.                 ParticleEffectAttach( "tank_cookoff", PATTACH_ABSORIGIN_FOLLOW, prop, 0 )
  1170.                 -- tank_cookoff
  1171.            
  1172.             end
  1173.             -- print( dist, k )
  1174.        
  1175.         end
  1176.    
  1177.     end
  1178.    
  1179.     if( self.HealthVal < .35 * self.InitialHealth ) then    
  1180.        
  1181.         self:SetNWBool("RadarFucked",true)
  1182.        
  1183.     end
  1184.    
  1185.     if( atk:IsPlayer() && dmg > 25 ) then
  1186.    
  1187.         -- atk:PrintMessage( HUD_PRINTTALK, "You dealt "..math.floor( dmg ).." damage to "..self.PrintName )
  1188.         atk:SendLua("HitMarker("..math.floor(dmg)..")")
  1189.    
  1190.     end
  1191.     local damagepos = dmginfo:GetDamagePosition()
  1192.     if( self.CitadelPos ) then
  1193.         -- print( ( damagepos - self:LocalToWorld( self.CitadelPos ) ):Length() )
  1194.         if( ( damagepos - self:LocalToWorld( self.CitadelPos ) ):Length() < 25 ) then
  1195.            
  1196.             self.CitadelHealth = self.CitadelHealth - dmg
  1197.             -- print( self.CitadelHealth )
  1198.             if( self.CitadelHealth <= 0 ) then
  1199.            
  1200.                 self.Destroyed = true
  1201.                
  1202.                 util.BlastDamage( self, dmginfo:GetAttacker(), self:LocalToWorld( self.CitaDelPos ), 500, math.random(750,1500) )
  1203.                 ParticleEffect( "water_impact_big", pos, Angle(0,0,0), nil )
  1204.                 ParticleEffect( "rt_impact", pos, Angle(0,0,0), nil )
  1205.                
  1206.             end
  1207.        
  1208.         end
  1209.    
  1210.     end
  1211.    
  1212.     if( self.RudderPos ) then
  1213.        
  1214.         if( ( damagepos - self:LocalToWorld( self.RudderPos ) ):Length() < 25 ) then
  1215.            
  1216.             self.RudderHealth = self.RudderHealth - dmg
  1217.            
  1218.             if( self.RudderHealth <= 0 ) then
  1219.            
  1220.                 self.RudderIsFucked = true
  1221.                
  1222.                 if( IsValid( self.Pilot ) ) then
  1223.                
  1224.                     self.Pilot:SendLua("HitMarker([[Your rudder was destroyed!]])")
  1225.                    
  1226.                 end
  1227.                
  1228.                 return
  1229.                
  1230.             end
  1231.            
  1232.         end
  1233.    
  1234.     end
  1235.    
  1236.     if( self.Weaponry ) then
  1237.        
  1238.        
  1239.         for k,v in ipairs( self.Weaponry ) do
  1240.        
  1241.             if( IsValid( v.Base ) && !v.Destroyed ) then
  1242.            
  1243.                 local dist = dampos:DistToSqr( v.Base:GetPos() )
  1244.                 if( dist < 8500 ) then
  1245.                
  1246.                     v.HealthVal = v.HealthVal - dmg
  1247.                     -- print( math.floor( v.HealthVal ))
  1248.                     if( v.HealthVal <= 0 ) then
  1249.                    
  1250.                         v.Destroyed = true
  1251.                         if( IsValid( v.Barrel ) ) then
  1252.                        
  1253.                             v.Barrel:SetColor( Color( 45,45,45,255 ) )
  1254.                            
  1255.                         end
  1256.                        
  1257.                         if( IsValid( v.Turret )&& IsValid( v.Turret.Barrel ) ) then
  1258.                        
  1259.                             v.Turret:SetColor( Color( 45,45,45,255 ) )
  1260.                             v.Turret.Barrel:SetColor( Color( 45,45,45,255 ) )
  1261.                             v.Turret:Ignite( 500, 16 )
  1262.                            
  1263.                         end
  1264.                        
  1265.                        
  1266.                         self:EmitSound("Misc/fire.wav")
  1267.                         ParticleEffect("neuro_gascan_explo", v.Base:GetPos(), Angle(0,0,0), v.Base )
  1268.                         ParticleEffectAttach( "fire_b", PATTACH_ABSORIGIN_FOLLOW, v.Base, 0 )
  1269.                         timer.Simple( math.random(10,15), function()
  1270.                             -- ToDo: Fire Fighting QTE
  1271.                             if( IsValid( v.Base ) ) then
  1272.                            
  1273.                                 v.Base:StopParticles()
  1274.                                
  1275.                             end
  1276.                            
  1277.                         end )
  1278.                        
  1279.                         if( IsValid( atk ) && atk:IsPlayer() && v.HealthVal <= 0 ) then
  1280.                            
  1281.                             atk:SendLua("HitMarker([["..v.Name.." destroyed!]])")
  1282.                        
  1283.                         end
  1284.                        
  1285.                    
  1286.                         break
  1287.                        
  1288.                     end
  1289.                
  1290.                 end
  1291.            
  1292.            
  1293.             end
  1294.            
  1295.         end
  1296.        
  1297.    
  1298.     end
  1299.    
  1300.     -- if( self.WeaponSystems ) then
  1301.        
  1302.         -- for k,v in pairs( self.WeaponSystems ) do
  1303.            
  1304.             -- if ( IsValid( v.Barrel ) ) then
  1305.                
  1306.                
  1307.             -- end
  1308.        
  1309.         -- end
  1310.    
  1311.     -- end
  1312.    
  1313.     --DamagedPoints
  1314.     if( dmg > 350 ) then
  1315.        
  1316.         -- print( "ouch" )
  1317.         local tr,trace = {},{}
  1318.         tr.start = dmginfo:GetDamagePosition()
  1319.         tr.endpos = self:GetPos()
  1320.         tr.filter = {}
  1321.         tr.mask = MASK_SOLID
  1322.         trace = util.TraceLine( tr )
  1323.        
  1324.         local a,b = trace.HitPos + trace.HitNormal, trace.HitPos - trace.HitNormal
  1325.         util.Decal("Scorch", a, b )
  1326.            
  1327.         self.BuoyancyRatio = self.BuoyancyRatio * 0.9999
  1328.        
  1329.         -- if( self:WaterLevel() == 2 ) then self.Destroyed = true return end
  1330.        
  1331.         local normdist = -20
  1332.         if( self.IsMicroCruiser ) then
  1333.        
  1334.             normdist = -2
  1335.            
  1336.         end
  1337.         if( trace.Hit && IsValid( trace.Entity ) && trace.Entity == self  && self.HealthVal < .85 * self.InitialHealth ) then
  1338.            
  1339.             if( self.DamagedPoints == nil ) then self.DamagedPoints = {} end
  1340.            
  1341.             if( self.DamagePoints == {} ) then
  1342.            
  1343.                 self.DamagedPoints[1] = self:WorldToLocal( trace.HitPos + trace.HitNormal * normdist )
  1344.            
  1345.             else
  1346.            
  1347.                 self.DamagedPoints[#self.DamagedPoints+1] = self:WorldToLocal( trace.HitPos + trace.HitNormal * normdist )
  1348.                
  1349.                 local waterballast = ents.Create("prop_physics_override")
  1350.                 waterballast:SetPos(  trace.HitPos + trace.HitNormal * normdist )
  1351.                 waterballast:SetAngles( self:GetAngles() )
  1352.                 waterballast:SetModel( "models/props_junk/popcan01a.mdl" )
  1353.                 waterballast:Spawn()
  1354.                 self:DeleteOnRemove( waterballast )
  1355.                 waterballast:SetNoDraw( true )
  1356.                 waterballast:GetPhysicsObject():SetMass( self:GetPhysicsObject():GetMass() * .015 )
  1357.                 constraint.Weld( self, waterballast, 0,0,0, true, false )
  1358.                
  1359.                
  1360.             end
  1361.            
  1362.         end
  1363.    
  1364.    
  1365.     end
  1366.  
  1367.     if ( self.HealthVal < 0 ) then
  1368.        
  1369.         -- if( IsValid( self.KeepUp ) ) then
  1370.            
  1371.             -- self.KeepUp:Remove()
  1372.        
  1373.         -- end
  1374.        
  1375.         if( self:WaterLevel() > 0 && !self.IsMicroCruiser ) then
  1376.        
  1377.             ParticleEffect( "water_impact_big", self:GetPos(), Angle(0,0,0), nil )
  1378.             ParticleEffect( "HE_impact_wall", self:GetPos()+self:GetUp() * 100, Angle(0,0,0), nil )
  1379.        
  1380.         end
  1381.        
  1382.    
  1383.         self:EmitSound( "ambient/explosions/explode_2.wav", 511, 100 )
  1384.        
  1385.  
  1386.    
  1387.         self.Destroyed = true
  1388.         self.BuoyancyRatio = self.BuoyancyRatio * .65
  1389.         self:GetPhysicsObject():SetBuoyancyRatio( self.BuoyancyRatio )
  1390.        
  1391.     end
  1392.    
  1393. end
  1394.  
  1395. function Meta:EjectCaptain()
  1396.    
  1397.     if ( !IsValid( self.Pilot ) ) then
  1398.    
  1399.         return
  1400.        
  1401.     end
  1402.    
  1403.     self.LastUse = CurTime()
  1404.     self.Owner = NULL
  1405.     self.Pilot:UnSpectate()
  1406.     self.Pilot:DrawViewModel( true )
  1407.     self.Pilot:DrawWorldModel( true )
  1408.     self.Pilot:SetMoveType( MOVETYPE_WALK )
  1409.     self.Pilot:Spawn()
  1410.    
  1411.     self.Pilot:SetNetworkedBool( "ToSea", false )
  1412.     self:SetNetworkedEntity( "Pilot", NULL )
  1413.     self.Pilot:SetNetworkedEntity( "Ship", NULL )
  1414.     -- self.Pilot:SetNetworkedEntity( "Plane", NULL )
  1415.     self.Pilot:SetNetworkedBool( "InFlight", false )
  1416.     self.Pilot:SetNetworkedBool( "DrawDesignator", false )
  1417.    
  1418.     self.Pilot:SetPos( self:LocalToWorld( self.ExitPos ) )
  1419.     self.Pilot:SetAngles( Angle( 0, self:GetAngles().y,0 ) )
  1420.     self.Owner = NULL
  1421.     self.Pilot:SetScriptedVehicle( NULL )
  1422.     if( !self.IsMicroCruiser ) then
  1423.    
  1424.         self.Speed = 0
  1425.         self:NextThink( CurTime() + 2 )
  1426.         self.EngineSound:Stop()
  1427.    
  1428.     end
  1429.  
  1430.     self.IsBoating = false
  1431.     self.Pilot = NULL
  1432.  
  1433.     return
  1434.    
  1435. end
  1436.  
  1437. function Meta:NeuroNaval_DefaultUse( ply, caller )
  1438.  
  1439.  
  1440.     if( ply == self.Pilot ) then return end
  1441.    
  1442.     if ( !self.IsBoating && !IsValid( self.Pilot ) && self.LastUse + 1 <= CurTime() ) then
  1443.        
  1444.         self.LastUse = CurTime()
  1445.         ply.SelectedWeapon = 1
  1446.         ply:SetNWInt("Selected_Weapon", 1 )
  1447.         self:GetPhysicsObject():Wake()
  1448.         self:GetPhysicsObject():EnableMotion(true)
  1449.         self.IsBoating = true
  1450.         self.Pilot = ply
  1451.         self.Owner = ply
  1452.  
  1453.         ply:Spectate( OBS_MODE_CHASE  )
  1454.         ply:DrawViewModel( false )
  1455.         ply:DrawWorldModel( false )
  1456.         ply:StripWeapons()
  1457.         ply:SetMoveType(MOVETYPE_NONE )
  1458.         ply:SetScriptedVehicle( self )
  1459.         ply:SetNetworkedEntity( "Ship", self )
  1460.         -- ply:SetNetworkedEntity( "Plane", self )
  1461.         ply:SetNetworkedBool("ToSea", true)
  1462.         ply:SetNetworkedBool("InFlight", true)
  1463.         self:SetNetworkedEntity("Pilot", ply )
  1464.         self.EngineSound:PlayEx(512,100)
  1465.         self.WaterSound:PlayEx(512,100)
  1466.         timer.Simple( 0.5, function()
  1467.                
  1468.             if( IsValid( ply ) && IsValid( self ) ) then
  1469.            
  1470.                 self:NavalSendWeaponEntities(ply)
  1471.                 SendBoatWeapons( self )
  1472.            
  1473.             end
  1474.            
  1475.         end)
  1476.  
  1477.            
  1478.         if( self.IsMicroCruiser && !self.ShipName ) then
  1479.            
  1480.             ply:ConCommand("shipname")
  1481.            
  1482.         end
  1483.        
  1484.     else
  1485.        
  1486.         if( type( self.Cannons ) == "table" ) then
  1487.        
  1488.             local found = false
  1489.             local itr = 0
  1490.            
  1491.                
  1492.             while !found do
  1493.                 itr = itr + 1
  1494.                
  1495.                 if( itr > 10 ) then break end
  1496.                
  1497.                 local r = math.random(1,#self.Cannons)
  1498.                 local d = self.Cannons[r].Pilot
  1499.                 if( !IsValid( d ) && self.Cannons[r].VehicleType != nil ) then
  1500.                    
  1501.                     self.Cannons[r]:Use( ply, ply, 0, 0 )
  1502.                     found = true
  1503.                    
  1504.                     break
  1505.                    
  1506.                 end
  1507.                    
  1508.             end
  1509.            
  1510.         end
  1511.        
  1512.     end
  1513.    
  1514. end
  1515.  
  1516. function Meta:NeuroNaval_DefaultRemove()
  1517.  
  1518.     if ( IsValid( self.Pilot ) ) then
  1519.    
  1520.         self:EjectCaptain()
  1521.    
  1522.     end
  1523.    
  1524.     if( IsValid( self.KeepUp ) ) then
  1525.    
  1526.         self.KeepUp:Remove()
  1527.    
  1528.     end
  1529.    
  1530.     self.EngineSound:Stop()
  1531.     self.WaterSound:Stop()
  1532.  
  1533.     if (self.Radars) then
  1534.         for i=1,#self.Radars do
  1535.             if( IsValid( self.Radars[i] ) ) then self.Radars[i]:Remove() end   
  1536.         end
  1537.     end
  1538. end
  1539.  
  1540. function Meta:NeuroNaval_DefaultCollisionCallback( data, physobj )
  1541.    
  1542.     -- Do shit here
  1543.     if( data.HitEntity && ( data.HitEntity.IsMicroCruiser || data.HitEntity == game.GetWorld() ) ) then
  1544.        
  1545.         -- print( self, "Speed: "..math.floor(data.Speed), data.DeltaTime, data.HitForce )
  1546.         if( data.DeltaTime > 0.1 && data.Speed > 0 ) then
  1547.            
  1548.             local fx = EffectData()
  1549.             fx:SetOrigin( data.HitPos )
  1550.             fx:SetStart( data.HitPos )
  1551.             fx:SetNormal( data.HitNormal *-1)
  1552.             fx:SetEntity( data.HitEntity )
  1553.             fx:SetScale( 1 )
  1554.             fx:SetMagnitude( 10 )
  1555.             util.Effect( "cball_explode", fx )         
  1556.             local fx = EffectData()
  1557.             fx:SetOrigin( data.HitPos )
  1558.             fx:SetStart( data.HitPos )
  1559.             fx:SetNormal( data.HitNormal *-1)
  1560.             fx:SetEntity( data.HitEntity )
  1561.             fx:SetScale( 1 )
  1562.             fx:SetMagnitude( 10 )
  1563.             util.Effect( "ManhackSparks", fx )
  1564.            
  1565.             self.HealthVal = self.HealthVal - math.random(5,10)*data.Speed
  1566.             self:SetNWInt("health",math.floor(self.HealthVal))
  1567.            
  1568.            
  1569.         end
  1570.        
  1571.         if( data.Speed > 5 && data.DeltaTime > .5 ) then
  1572.            
  1573.             if( math.random( 1,2) == 2 ) then
  1574.            
  1575.                 self:EmitSound( "ambient/materials/metal_stress"..math.random(1,5)..".wav", 511, 100 )
  1576.            
  1577.             else
  1578.                    
  1579.                 self:EmitSound( "doors/heavy_metal_move1.wav", 511, math.random(80,120) )
  1580.            
  1581.             end
  1582.            
  1583.         end
  1584.        
  1585.     end
  1586.    
  1587. end
  1588.  
  1589. function Meta:NeuroNaval_DefaultCruiserInit()
  1590.    
  1591.    
  1592.     self.FuckedUpAngle = AngleRand() * 180
  1593.     self.DamagedPoints = {}
  1594.     self.ActualSpeed = 0
  1595.     self.HealthVal = self.InitialHealth
  1596.     self.EngineSound = CreateSound( self, self.EngineSoundPath )
  1597.     self.WaterSound = CreateSound( self, "Misc/water_movement.wav" )
  1598.     self.GroupShotCounter = 0
  1599.     self.GroupShotCooldown = 0
  1600.    
  1601.     self.ShipAngleForce = Angle(0,0,0)
  1602.     self.ShipAngleForceTargetValue = 0
  1603.     self.ShipAngleForceCurrentValue = 0
  1604.    
  1605.     self.LastAttackKeyDown = 0
  1606.     self.LastReminder = 0
  1607.     self.LastUse = CurTime()
  1608.     self.LastAttack = CurTime()
  1609.    
  1610.     self.Destroyed = false
  1611.     self.Burning = false
  1612.     self.Speed = 0
  1613.     self.DeathTimer = 0
  1614.  
  1615.     -- // Timers
  1616.     self.LastPrimaryAttack = 0
  1617.     self.LastSecondaryAttack = 0
  1618.     self.LastFireModeChange = 0
  1619.  
  1620.     if( type(self.Armament) == "table" ) then
  1621.        
  1622.         // Armamanet
  1623.         local i = 0
  1624.         local c = 0
  1625.         self.FireMode = 1
  1626.         self.EquipmentNames = {}
  1627.         self.RocketVisuals = {}
  1628.        
  1629.         for k,v in pairs( self.Armament ) do
  1630.            
  1631.             i = i + 1
  1632.             self.RocketVisuals[i] = ents.Create("prop_physics_override")
  1633.             self.RocketVisuals[i]:SetModel( v.Mdl )
  1634.             self.RocketVisuals[i]:SetPos( self:GetPos() + self:GetForward() * v.Pos.x + self:GetRight() * v.Pos.y + self:GetUp() * v.Pos.z )
  1635.             self.RocketVisuals[i]:SetAngles( self:GetAngles() + v.Ang )
  1636.             self.RocketVisuals[i]:SetParent( self )
  1637.             self.RocketVisuals[i]:SetSolid( SOLID_NONE )
  1638.             self.RocketVisuals[i].Type = v.Type
  1639.             self.RocketVisuals[i].PrintName = v.PrintName
  1640.             self.RocketVisuals[i].Cooldown = v.Cooldown
  1641.             self.RocketVisuals[i].isFirst = v.isFirst
  1642.             self.RocketVisuals[i].Identity = i
  1643.             self.RocketVisuals[i].Owner = self
  1644.             self.RocketVisuals[i].Class = v.Class
  1645.             self.RocketVisuals[i]:Spawn()
  1646.             self.RocketVisuals[i].LastAttack = CurTime()
  1647.            
  1648.             if ( v.Damage && v.Radius ) then
  1649.                
  1650.                 self.RocketVisuals[i].Damage = v.Damage
  1651.                 self.RocketVisuals[i].Radius = v.Radius
  1652.            
  1653.             end
  1654.            
  1655.             if( v.SubType ) then
  1656.                
  1657.                 self.RocketVisuals[i].SubType = v.SubType
  1658.                
  1659.             end
  1660.            
  1661.             // Usuable Equipment
  1662.             if ( v.isFirst == true || v.isFirst == nil /* Single Missile*/ ) then
  1663.            
  1664.                 if ( v.Type != "Effect" && v.Type != "Flarepod" ) then
  1665.                    
  1666.                     c = c + 1
  1667.                     self.EquipmentNames[c] = {}
  1668.                     self.EquipmentNames[c].Identity = i
  1669.                     self.EquipmentNames[c].Name = v.PrintName
  1670.                    
  1671.                 end
  1672.                
  1673.             end
  1674.            
  1675.         end
  1676.        
  1677.         self.NumRockets = #self.EquipmentNames
  1678.        
  1679.     end
  1680.    
  1681.     self:SetUseType( SIMPLE_USE )
  1682.     self.IsBoating = false
  1683.     self.Pilot = NULL
  1684.    
  1685.    
  1686.     if( self.CannonType == 1 ) then
  1687.  
  1688.         self.Cannons = {}
  1689.         for i=1,#self.CannonPos do
  1690.            
  1691.             local pos = self.CannonPos[i]
  1692.             if( self.WorldScale ) then 
  1693.                 pos = pos * self.WorldScale
  1694.                
  1695.             end
  1696.             self.Cannons[i] = ents.Create( self.CannonTypes[i] )
  1697.             self.Cannons[i]:SetPos( self:LocalToWorld( pos ) )
  1698.             self.Cannons[i]:SetAngles( self:GetAngles() + self.CannonAngles[i] )
  1699.             self.Cannons[i]:SetParent( self )
  1700.             self.Cannons[i]:Spawn()
  1701.             self.Cannons[i].Owner = self
  1702.             self.Cannons[i].Ship = self
  1703.             if( self.Cannons[i].Tower ) then
  1704.            
  1705.                 self.Cannons[i].Tower:SetSolid( SOLID_NONE )
  1706.                 self.Cannons[i].Barrel:SetSolid( SOLID_NONE )
  1707.            
  1708.             end
  1709.            
  1710.            
  1711.             -- local weld = constraint.Weld( self.Cannons[i], self, 0, 0, 0, true )
  1712.        
  1713.         end
  1714.    
  1715.     end
  1716.    
  1717.     if( self.HasAdvancedSAMSystem ) then
  1718.        
  1719.        
  1720.        
  1721.    
  1722.     end
  1723.    
  1724.     // Misc
  1725.     self:SetModel( self.Model )
  1726.     self:PhysicsInit( SOLID_VPHYSICS )
  1727.     self:SetMoveType( MOVETYPE_VPHYSICS )
  1728.     self:SetSolid( SOLID_VPHYSICS )
  1729.  
  1730.     self.PhysObj = self:GetPhysicsObject()
  1731.  
  1732.    
  1733.     if ( IsValid( self.PhysObj ) ) then
  1734.    
  1735.         self.PhysObj:Wake()
  1736.         self.PhysObj:EnableDrag( true )
  1737.         self.PhysObj:SetBuoyancyRatio( self.BuoyancyRatio )
  1738.         if( self.Mass ) then
  1739.            
  1740.             self.PhysObj:SetMass( self.Mass )
  1741.            
  1742.         end
  1743.        
  1744.         if( self.DampFactor ) then
  1745.        
  1746.             self.PhysObj:SetDamping( self.DampFactor, self.DampFactor ) -- assume linear because lazy
  1747.        
  1748.         else
  1749.        
  1750.             self.PhysObj:SetDamping( 0.25, 0.5 ) -- magic
  1751.            
  1752.         end
  1753.        
  1754.     end
  1755.  
  1756.     self:StartMotionController()
  1757.      
  1758.     self.KeepUp = ents.Create("prop_physics")
  1759.     if( self.IsMicroCruiser ) then
  1760.    
  1761.         self.KeepUp:SetModel("models/Combine_Helicopter/helicopter_bomb01.mdl")
  1762.    
  1763.     else
  1764.        
  1765.         self.KeepUp:SetModel( "models/props_wasteland/cargo_container01.mdl" )
  1766.    
  1767.     end
  1768.    
  1769.     self.KeepUp:SetPos( self:LocalToWorld(  Vector( -10, 0, 0 ) ) )
  1770.     self.KeepUp:SetAngles( self:GetAngles() + Angle( 0, 90, 0 ) )
  1771.     self.KeepUp:Spawn()
  1772.     self.KeepUp.Owner = self
  1773.     self.KeepUp:Activate()
  1774.     self.KeepUp:SetColor( Color( 255, 255, 255, 0) )
  1775.     self.KeepUp:SetNoDraw( true )
  1776.     self.KeepUp:SetRenderMode( RENDERMODE_TRANSALPHA )
  1777.     -- self.KeepUp:SetOwner( self )
  1778.    
  1779.     self.KeepUpPhysObj = self.KeepUp:GetPhysicsObject()
  1780.     self:DeleteOnRemove( self.KeepUp )
  1781.     if ( self.KeepUpPhysObj:IsValid() ) then
  1782.        
  1783.         self.KeepUpPhysObj:SetMass( self.KeepUpWeight or 1000 )
  1784.         self.KeepUpPhysObj:EnableDrag( true )
  1785.        
  1786.     end
  1787.        
  1788.     local weld = constraint.Weld( self.KeepUp, self, 0, 0, 0, true )
  1789.     local keepup = constraint.Keepupright( self.KeepUp, Angle( 0,0,0 ), 0, 100 )
  1790.  
  1791.     if ( self.RadarPositions ) then
  1792.         -- print( "walla" )
  1793.         self.Radars = {}
  1794.         self.RadarAxis = {}
  1795.         self.RadarsPhysObj = {}
  1796.        
  1797.         for i=1,#self.RadarPositions do
  1798.            
  1799.             self.Radars[i] = ents.Create("prop_physics")
  1800.             self.Radars[i]:SetPos( self:LocalToWorld( self.RadarPositions[i] ) )
  1801.             self.Radars[i]:SetAngles( self.RadarAngles[i] )
  1802.             self.Radars[i]:SetModel( self.RadarModels[i] )
  1803.             self.Radars[i]:Spawn()
  1804.            
  1805.             self.RadarsPhysObj[i] = self.Radars[i]:GetPhysicsObject()      
  1806.             if ( self.RadarsPhysObj[i]:IsValid() ) then        
  1807.                 self.RadarsPhysObj[i]:SetMass( 55 )
  1808.                 self.RadarsPhysObj[i]:EnableDrag( true )               
  1809.                 self.RadarsPhysObj[i]:Wake()       
  1810.             end
  1811.            
  1812.             self.RadarAxis[i] = constraint.Axis( self.Radars[i], self, 0, 0, Vector(0,0,1),self.RadarPositions[i], 0, 0, 1, 0 )
  1813.             -- print( self.RadarAxis[i] )
  1814.         end
  1815.        
  1816.    
  1817.     end
  1818.          
  1819.      if( self.WeaponSystems ) then
  1820.  
  1821.         -- Base = "models/magnet/submine/submine.mdl",
  1822.         -- BPos =Vector( 1121, -0, 569 ),
  1823.         -- Turret = "models/Battleships/Yamato/yamato_mainturret.mdl",
  1824.         -- TPos = Vector( 1121, -0, 569 ),
  1825.         -- Barrel = "models/Battleships/Yamato/yamato_mainturret_cannon.mdl",
  1826.         -- BaPos = Vector( 1221, -0, 580 ),
  1827.         -- AmmoType = "",
  1828.         -- Cooldown = 15,
  1829.         -- Damage = 5000,
  1830.         -- MaxYaw = 90
  1831.         self.Weaponry = {}
  1832.        
  1833.         -- PrintTable( self.WeaponSystems )
  1834.         for k,v in pairs( self.WeaponSystems ) do
  1835.             -- print( k, v, self.Weaponry )
  1836.            
  1837.             self.Weaponry[k] = {}
  1838.             self.Weaponry[k].LastAttack = 0
  1839.             self.Weaponry[k].AmmoCounter = v.AmmoCounter or 500
  1840.             self.Weaponry[k].Cooldown = v.Cooldown or 0.3
  1841.             self.Weaponry[k].Damage = v.Damage
  1842.             self.Weaponry[k].Radius = v.Radius or 128
  1843.             self.Weaponry[k].AmmoType = v.AmmoType
  1844.             self.Weaponry[k].AmmoModel = v.AmmoModel -- display model for ammo
  1845.             self.Weaponry[k].BarrelLength = v.BarrelLength -- shell offset from barrel
  1846.             self.Weaponry[k].MaxYaw = v.MaxYaw -- 2*maxyaw = field of view for the cannon
  1847.             self.Weaponry[k].ShootSound = v.ShootSound -- guess
  1848.             self.Weaponry[k].NumShots = v.NumShots -- Burst Size
  1849.             self.Weaponry[k].BarrelPorts = v.BarrelPorts -- Table of vectors to emit shells from
  1850.             self.Weaponry[k].Muzzle = v.Muzzle -- muzzleflash
  1851.             self.Weaponry[k].WeaponGroup = v.WeaponGroup -- used for hud and weapon switching
  1852.             self.Weaponry[k].GroupedShotDelay = v.GroupedShotDelay or 20
  1853.             self.Weaponry[k].DontAnimateBarrel = v.DontAnimateBarrel
  1854.             self.Weaponry[k].DontPitchBarrel = v.DontPitchBarrel
  1855.             self.Weaponry[k].ShellVelocity = v.ShellVelocity
  1856.             self.Weaponry[k].NoShellBoost = v.NoShellBoost
  1857.             self.Weaponry[k].Recoil = v.Recoil
  1858.             self.Weaponry[k].TAng = v.TAng -- Tower offset angle
  1859.             self.Weaponry[k].UseHitScan = v.UseHitScan
  1860.             self.Weaponry[k].PenetrationDepth = v.PenetrationDepth -- Tower offset angle
  1861.             self.Weaponry[k].Name = v.Name or "Weapon "
  1862.             self.Weaponry[k].DisableIPP = v.DisableIPP -- Disable impact point prediction ( use for flak etc, stuff that shoots straight )
  1863.             self.Weaponry[k].TowerTurnSpeed = v.TowerTurnSpeed or 1.35
  1864.             local BaseAng = v.TAng != nil and v.TAng or Angle( 0,0,0 )
  1865.             self.Weaponry[k].Base = ents.Create("prop_physics")
  1866.             self.Weaponry[k].Base:SetModel( v.Base )
  1867.             self.Weaponry[k].Base:SetPos( self:LocalToWorld( v.BPos ) )
  1868.             self.Weaponry[k].Base:SetAngles( self:GetAngles() + BaseAng )
  1869.             self.Weaponry[k].Base:SetMoveType( MOVETYPE_NONE )
  1870.             self.Weaponry[k].Base:SetParent( self )
  1871.             self.Weaponry[k].Base:Spawn()
  1872.             self.Weaponry[k].Base:PhysicsDestroy()
  1873.             self.Weaponry[k].Base:SetNoDraw( true )
  1874.             self.Weaponry[k].InitialHealth = self.InitialHealth*.15
  1875.             self.Weaponry[k].HealthVal = self.InitialHealth*.15
  1876.            
  1877.             -- self.Weaponry[k].Base:GetPhysicsObject():SetMass( 50 )
  1878.            
  1879.             self.Weaponry[k].Turret = ents.Create("prop_physics")
  1880.             self.Weaponry[k].Turret:SetModel( v.Turret )
  1881.             self.Weaponry[k].Turret:SetPos( self:LocalToWorld( v.TPos ) )
  1882.             if( v.TAng ) then
  1883.                
  1884.                 local ang = self:GetAngles()
  1885.                 ang:RotateAroundAxis( self:GetRight(), v.TAng.p )
  1886.                 ang:RotateAroundAxis( self:GetUp(), v.TAng.y )
  1887.                 ang:RotateAroundAxis( self:GetForward(), v.TAng.r )
  1888.            
  1889.                 self.Weaponry[k].Turret:SetAngles( ang )
  1890.            
  1891.             else
  1892.            
  1893.                 self.Weaponry[k].Turret:SetAngles( self:GetAngles() )
  1894.            
  1895.             end
  1896.             self.Weaponry[k].Turret:SetMoveType( MOVETYPE_NONE )
  1897.             self.Weaponry[k].Turret:SetParent( self.Weaponry[k].Base )
  1898.             local tur = self.Weaponry[k].Turret
  1899.             timer.Simple( 0, function()
  1900.                 if ( IsValid( tur ) ) then
  1901.                    
  1902.                     tur:SetNWInt("WeaponTableIndex", k ) -- so we can read the data on the client.
  1903.                    
  1904.                 end
  1905.                
  1906.             end )
  1907.            
  1908.             self.Weaponry[k].Turret:Spawn()
  1909.             self.Weaponry[k].Turret:PhysicsDestroy()
  1910.            
  1911.             -- self.Weaponry[k].Turret:GetPhysicsObject():SetMass( 50 )
  1912.             -- local _barrelang =
  1913.             self.Weaponry[k].Barrel = ents.Create("prop_physics")
  1914.             self.Weaponry[k].Barrel:SetModel( v.Barrel )
  1915.             self.Weaponry[k].Barrel:SetPos( self:LocalToWorld( v.BaPos ) )
  1916.             self.Weaponry[k].Barrel:SetAngles( self.Weaponry[k].Turret:GetAngles() )
  1917.             self.Weaponry[k].Barrel:SetMoveType( MOVETYPE_NONE )
  1918.             self.Weaponry[k].Barrel:SetParent( self.Weaponry[k].Turret )
  1919.             self.Weaponry[k].Barrel:Spawn()
  1920.             self.Weaponry[k].Barrel:PhysicsDestroy()
  1921.             -- self.Weaponry[k].Barrel:GetPhysicsObject():SetMass( 50 )
  1922.            
  1923.            
  1924.         end
  1925.        
  1926.     end
  1927.      
  1928.      if( self.CaptainsChairPosition ) then
  1929.          
  1930.         self.CaptainsSeat = ents.Create( "prop_vehicle_prisoner_pod" )
  1931.         self.CaptainsSeat:SetPos( self:LocalToWorld( pos ) )
  1932.         self.CaptainsSeat:SetModel( "models/nova/jeep_seat.mdl" )
  1933.         self.CaptainsSeat:SetKeyValue( "LimitView", "0" )
  1934.         self.CaptainsSeat:SetKeyValue( "vehiclescript", "scripts/vehicles/prisoner_pod.txt" )
  1935.         self.CaptainsSeat.HandleAnimation = function( v, p ) return p:SelectWeightedSequence( ACT_DRIVE_AIRBOAT ) end
  1936.         self.CaptainsSeat:SetAngles( self:GetAngles() + ang )
  1937.         self.CaptainsSeat:SetParent( self )
  1938.         self.CaptainsSeat:SetColor( Color( 0,0,0,0 ) )
  1939.         self.CaptainsSeat:SetRenderMode( RENDERMODE_TRANSALPHA )
  1940.         self.CaptainsSeat:Spawn()
  1941.  
  1942.        
  1943.     end
  1944.        
  1945.     if( self.DeckModel ) then
  1946.  
  1947.         self.Deck = ents.Create("boat_part")
  1948.        
  1949.         self.Deck:SetPos( self:LocalToWorld( self.DeckPosition or Vector() ) )
  1950.         self.Deck:SetAngles( self:GetAngles() )
  1951.         self.Deck:SetColor( Color( 255,255,255,255 ) )
  1952.         self.Deck:Spawn()
  1953.         self.Deck:SetModel( self.DeckModel )
  1954.         self.Deck:SetMoveType( MOVETYPE_VPHYSICS )
  1955.         self.Deck:PhysicsInit( MOVETYPE_VPHYSICS )
  1956.         self.Deck:SetSolid( SOLID_VPHYSICS )   
  1957.         self.Deck:Activate()
  1958.        
  1959.         self.Deck.InitialHealth = self.InitialHealth
  1960.         self.Deck.HealthVal = self.InitialHealth
  1961.         self.Deck.IsShipDeck = true
  1962.         self:DeleteOnRemove( self.Deck )
  1963.         -- print( self.Deck.InitialHealth )
  1964.         self.Deck.Weld = constraint.Weld( self.Deck, self, 0, 0, 0, true, false  )
  1965.        
  1966.         self.HasDeck = true
  1967.         -- self.Deck:PhysicsDestroy()
  1968.         -- self.Deck:GetPhysicsObject():SetMass( 50 )
  1969.          
  1970.     end
  1971.                     -- for i=0,self:GetBoneCount() do
  1972.                     -- local rpos,rang = self:GetBonePosition( i )
  1973.                     -- print( rpos, rang  )
  1974.                    
  1975.                 -- end
  1976.     timer.Simple( .0, function()
  1977.         if( IsValid( self ) ) then
  1978.        
  1979.             self:SetNWInt( "health",self.HealthVal)
  1980.             self:SetNWInt( "MaxHealth",self.InitialHealth)
  1981.             self:SetNWInt( "MaxSpeed",self.MaxVelocity)
  1982.            
  1983.  
  1984.    
  1985.             if( self:GetBoneCount() > 1 ) then
  1986.                
  1987.                 -- for i=1,self:GetBoneCount() do
  1988.                
  1989.                     -- print( self:GetBonePosition( i ) )
  1990.                
  1991.                 -- end
  1992.                 local Citadel = self:LookupBone("Citadel")
  1993.                 local Rudder = self:LookupBone("Rudder")
  1994.                 if( Citadel ) then
  1995.                    
  1996.                     local p,a = self:GetBonePosition( Citadel )
  1997.                     self.CitadelPos = self:WorldToLocal( p )
  1998.                     self.CitadelHealth = self.InitialHealth * .15
  1999.            
  2000.                 end
  2001.                
  2002.                 if( Rudder ) then
  2003.                
  2004.                     local rpos,a2 = self:GetBonePosition( Rudder )             
  2005.                     self.RudderPos = self:WorldToLocal( rpos )
  2006.                     self.RudderHealth = self.InitialHealth * .1
  2007.                    
  2008.                 end
  2009.                
  2010.                 self.AmmoRacks = {}
  2011.                 for i=1,self:GetBoneCount() do
  2012.                    
  2013.                     local bone = self:GetBoneName( i )
  2014.                     if( string.find( bone,"Ammo") != nil ) then
  2015.                         local bp,ba = self:GetBonePosition( i )
  2016.                         table.insert( self.AmmoRacks,
  2017.                             {
  2018.                                 Health = self.InitialHealth*.05,
  2019.                                 Pos = self:WorldToLocal( bp ),
  2020.                                 Destroyed = false
  2021.                             }  )
  2022.                    
  2023.                     end
  2024.                    
  2025.                 end
  2026.                 -- print(rudder,"kebab?")
  2027.             /*
  2028.                
  2029.                 -- print(  self.RudderPos )
  2030.                 self.RudderAng = rang
  2031.                 self.Rudder = ents.Create("boat_part")
  2032.                 -- self.Rudder:SetPos( rpos )
  2033.                 self.Rudder:SetAngles( self:GetAngles()  )
  2034.                 self.Rudder:SetModel( "models/Gibs/HGIBS.mdl" )
  2035.                 self.Rudder:SetOwner( self )
  2036.                 self.Rudder.Owner = self
  2037.                 -- self.Rudder:SetMoveType( MOVETYPE_VPHYSICS )
  2038.                 -- self.Rudder:PhysicsInit( MOVETYPE_VPHYSICS )
  2039.                 -- self.Rudder:SetSolid( SOLID_VPHYSICS )  
  2040.                 self.Rudder:Spawn()
  2041.                 self.Rudder:Activate()
  2042.                 self.Rudder.HealthVal = self.InitialHealth * .1
  2043.                 self.Rudder.InitialHealth = self.InitialHealth * .1
  2044.                 -- self.RudderWeld = constraint.Weld( self, self.Rudder, 0, 0, 0, true, false )
  2045.                 self:DeleteOnRemove( self.Rudder )
  2046.                 -- print( rpos, rang )
  2047.              */
  2048.             end
  2049.            
  2050.         end
  2051.        
  2052.     end )
  2053.  
  2054. end
  2055.  
  2056. function Meta:NeurNaval_MissileJammer()
  2057.    
  2058.     local tr,trace = {},{}
  2059.     local Missile = NULL
  2060.     -- look for stuff
  2061.     for k,v in pairs( ents.FindInSphere( self:GetPos(), 5555 ) ) do
  2062.        
  2063.         -- print( v, v:GetVelocity():Length() )
  2064.         -- look for fast stuff that's not also not what we want it to be :v
  2065.         if ( v:GetVelocity():Length() > 5000 && !v:IsPlayer() && !v:IsNPC() && !v:IsVehicle() && v.HealthVal == nil ) then
  2066.            
  2067.             if( v:GetPos().z > self:GetPos().z ) then
  2068.            
  2069.                 -- look for stuff again
  2070.                 tr.start = v:GetPos()
  2071.                 tr.endpos = tr.start + v:GetForward() * 5555
  2072.                 tr.filter = v
  2073.                 tr.mask = MASK_SOLID
  2074.                 trace = util.TraceLine( tr )
  2075.                
  2076.                    
  2077.                 -- oh fuck is it coming at us?
  2078.                 if( trace.Hit && IsValid( trace.Entity ) ) then
  2079.                    
  2080.                     debugoverlay.Line( tr.start, trace.HitPos, 1, Color( 255,0,0,255 ), true  )
  2081.                     debugoverlay.Line( self:GetPos(), v:GetPos(), 1, Color( 0,255,0,255 ), true  )
  2082.                    
  2083.                     if( trace.Entity == self || ( IsValid( trace.Entity.Owner ) && trace.Entity.Owner == self ) ) then
  2084.                        
  2085.                         if( !v.JamDir || !v.JamDir2 ) then
  2086.                            
  2087.                             local r = ( math.random( 0,1) > 0 )
  2088.                             local r2 = ( math.random( 0,1) > 0 )
  2089.                             v.JamDir = -1
  2090.                             v.JamDir2 = -1
  2091.                             if( r ) then v.JamDir = 1 end
  2092.                             if( r2 ) then v.JamDir2 = 1 end
  2093.                            
  2094.                         end
  2095.                        
  2096.                         -- Alter its course slightly
  2097.                         v:SetAngles( v:GetAngles() +  Angle( 6.5*v.JamDir, 7.5*v.JamDir2, 0 ) )
  2098.                    
  2099.                     end
  2100.                
  2101.                 end
  2102.            
  2103.             end
  2104.            
  2105.         end
  2106.    
  2107.     end
  2108.  
  2109. end
  2110.  
  2111. function Meta:BoatSAMPhysics()
  2112.  
  2113.     if ( self.IsBoating && IsValid( self.Pilot ) ) then
  2114.  
  2115.         -- print( "boating" )
  2116.        
  2117.         self:GetPhysicsObject():Wake()
  2118.        
  2119.         local plr = self.Pilot
  2120.         local hasSAMPilot = false
  2121.        
  2122.         if( IsValid( self.SAMSeat ) ) then
  2123.        
  2124.             if( IsValid( self.SAMSeat:GetDriver() ) ) then
  2125.                
  2126.                 plr = self.SAMSeat:GetDriver()
  2127.                 hasSAMPilot = true
  2128.                
  2129.             end
  2130.            
  2131.         end
  2132.        
  2133.         local a = plr:GetPos() + plr:GetAimVector() * 3000 // This is the point the plane is chasing.
  2134.        
  2135.         if( self.Aimbot && IsValid( self.AimTarget ) ) then
  2136.            
  2137.             a = self.AimTarget:GetPos()
  2138.            
  2139.         end
  2140.        
  2141.         local ta = ( self:GetPos() - a ):Angle()
  2142.         local ma = self:GetAngles()
  2143.        
  2144.        
  2145.         local pilotAng = plr:EyeAngles()
  2146.        
  2147.         if( self.Aimbot && IsValid( self.AimTarget ) ) then
  2148.            
  2149.             pilotAng = ( self:GetPos() - self.AimTarget:GetPos() ):Angle()
  2150.            
  2151.         end
  2152.        
  2153.         local _t = self.Tower:GetAngles()
  2154.         local barrelpitch = math.Clamp( pilotAng.p, -65, 10 )
  2155.  
  2156.         self.offs = self:VecAngD( ma.y, ta.y ) 
  2157.         local angg = self:GetAngles()
  2158.  
  2159.         angg:RotateAroundAxis( self:GetUp(), -self.offs + 180 )
  2160.        
  2161.         if( hasSAMPilot ) then
  2162.            
  2163.             local diff = self:VecAngD( plr:EyeAngles().y, self:GetAngles().y )
  2164.            
  2165.             if( diff > 10 || diff < -10 ) then
  2166.            
  2167.                
  2168.                 self.Tower:SetAngles( LerpAngle( 0.02, _t, angg ) )
  2169.            
  2170.             end
  2171.            
  2172.         else
  2173.        
  2174.        
  2175.             self.Tower:SetAngles( LerpAngle( 0.1, _t, angg ) )
  2176.        
  2177.         end
  2178.        
  2179.         _t = self.Tower:GetAngles()
  2180.         self.Barrel:SetAngles( Angle( barrelpitch, _t.y, _t.r ) )
  2181.  
  2182.     end
  2183.    
  2184. end
  2185.  
  2186. function Meta:BoatSAMLogic()
  2187.    
  2188.     local SD = self.SAMSeat:GetDriver()
  2189.     local plr = self.Pilot
  2190.    
  2191.     if( IsValid( SD ) ) then
  2192.        
  2193.         plr = SD
  2194.    
  2195.     end
  2196.    
  2197.    
  2198.     if( plr:KeyDown( IN_ATTACK ) ) then
  2199.        
  2200.         local tr,trace = {},{}
  2201.         tr.start = self.Barrel:GetPos() + self.Barrel:GetForward() * 140
  2202.         tr.endpos = tr.start + self.Barrel:GetForward() * 7000
  2203.         tr.filter = { self, self.Barrel, self.Tower, plr }
  2204.         tr.mask = MASK_SOLID
  2205.        
  2206.         trace = util.TraceEntity( tr, self.Barrel )
  2207.        
  2208.         -- local t1 = Vector( 10, 24, 34 )
  2209.         -- local t2 = Vector( 10, 24, 34 )
  2210.        
  2211.         -- self:DrawLaserTracer( self.Barrel:LocalToWorld( t1 ), trace.HitPos )
  2212.         -- self:DrawLaserTracer( self.Barrel:LocalToWorld( t2 ), trace.HitPos )
  2213.        
  2214.         if( !trace.HitWorld && trace.Hit && IsValid( trace.Entity ) && self.LastAttack + 0.75 <= CurTime() ) then
  2215.            
  2216.             -- self.Aimbot = true
  2217.             -- self.AimTarget = trace.Entity
  2218.  
  2219.             self.LastAttack = CurTime()
  2220.             self.Missile = ents.Create("sent_a3a_rocket")
  2221.             self.Missile:SetPos( self.Barrel:GetPos() + self.Barrel:GetForward() * 150 )
  2222.             self.Missile:SetAngles( self.Barrel:GetAngles() )
  2223.             self.Missile.Target = trace.Entity
  2224.             self.Missile:SetModel( "models/BF2/weapons/Predator/predator_rocket.mdl" )
  2225.             self.Missile.Owner = plr
  2226.             self.Missile.Damage = math.random( 400, 800 )
  2227.             self.Missile:SetOwner( self.Barrel )
  2228.             self.Missile:Spawn()
  2229.             self.Missile.Delay = 0
  2230.            
  2231.             local fx = EffectData()
  2232.             fx:SetOrigin( self.Missile:GetPos() )
  2233.             fx:SetScale( 3.0 )
  2234.             util.Effect( "launch2", fx )
  2235.            
  2236.             local fx = EffectData()
  2237.             fx:SetOrigin( self.Missile:GetPos() )
  2238.             fx:SetNormal( self.Missile:GetForward() * -1 )
  2239.             fx:SetScale( 0.5 )
  2240.             util.Effect( "tank_muzzle", fx )
  2241.            
  2242.             plr:PrintMessage( HUD_PRINTCENTER, "Taret Locked - Launching Missile")
  2243.            
  2244.             return
  2245.            
  2246.         end
  2247.        
  2248.     else
  2249.    
  2250.         -- self.Aimbot = false
  2251.         -- self.AimTarget = NULL
  2252.  
  2253.     end
  2254.    
  2255. end
  2256.  
  2257. function Meta:BoatRadarAnim()
  2258.  
  2259.     local plr = self.Pilot
  2260.     if( IsValid( self.SAMSeat ) ) then
  2261.         if( IsValid( self.SAMSeat:GetDriver() ) ) then         
  2262.             plr = self.SAMSeat:GetDriver()         
  2263.         end
  2264.     end
  2265.     local ma = self:GetAngles()            
  2266.     local pilotAng = plr:EyeAngles()       
  2267.     local a = plr:GetPos() + plr:GetAimVector() * 3000     
  2268.     local ta = ( self:GetPos() - a ):Angle()
  2269.  
  2270. /*
  2271. self.RadarAnimation=
  2272. 0: static
  2273. 1: simply rotate on z axis all the time.
  2274. 2: follow player aim.
  2275. 3: track the current target.
  2276. */
  2277.     if (self.Radars) then
  2278.         for i=1,#self.Radars do
  2279.             if( IsValid( self.Radars[i] ) ) then
  2280.             local _t = self.Radars[i]:GetAngles()
  2281.                 if self.RadarAnimation[i]==0 then
  2282.                     -- self.Radars[i]:SetAngles( self:GetAngles())
  2283.                 elseif self.RadarAnimation[i]==1 then
  2284.                     -- self:RadarsPhysObj[i]:AddAngleVelocity( Vector(1000,1000,100) )
  2285.                    
  2286.                 elseif self.RadarAnimation[i]==2 then
  2287.                    
  2288.                     -- self.Radars[i]:SetAngles( LerpAngle( 0.1, _t, Angle(ma.p,plr.y,ma.r) ) )
  2289.                
  2290.                 elseif self.RadarAnimation[i]==3 then
  2291.  
  2292.  
  2293.                     if( self.Aimbot && IsValid( self.AimTarget ) ) then        
  2294.                         a = self.AimTarget:GetPos()        
  2295.                     end    
  2296.                     if( self.Aimbot && IsValid( self.AimTarget ) ) then        
  2297.                         pilotAng = ( self:GetPos() - self.AimTarget:GetPos() ):Angle()         
  2298.                     end    
  2299.                     self.offs = self:VecAngD( ma.y, ta.y ) 
  2300.                     local angg = self:GetAngles()
  2301.                     angg:RotateAroundAxis( self:GetUp(), -self.offs + 180 )
  2302.                
  2303.                     self.Radars[i]:SetAngles( LerpAngle( 0.1, _t, angg ) )
  2304.  
  2305.                
  2306.                 end
  2307.            
  2308.             end
  2309.         end
  2310.     end
  2311. end
  2312.  
  2313. print( "[NeuroNaval] NeuroNavalGlobal.lua loaded!" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement