-- Behold the fury of the jectpack bots /ref function TestViewModel( seq, activator ) for _, viewmodel in pairs(ents.FindAllByClass("tf_viewmodel")) do if viewmodel.m_hOwner == activator then --viewmodel.m_nSequence = 0 timer.Simple(0.015, function() viewmodel.m_nSequence = seq end) end end end function OnGameTick() for _, player in pairs( ents.GetAllPlayers() ) do if player:IsPlayer() and player.Jetpack and ( not player:InCond( 51 ) ) then util.StartLagCompensation(player) local Trace = util.Trace({ start = player:GetAbsOrigin() + Vector(0, 0, 16), mask = MASK_PLAYERSOLID, angles = Vector(90, 0, 0), mins = Vector(-24, -24, 0), maxs = Vector(24, 24, 0), filter = ents.GetAllBots() }) util.FinishLagCompensation(player) local floor_height = Trace.HitPos.z local target_height = floor_height + player.JetpackHeight local cur_pos = player:GetAbsOrigin() local cur_height = cur_pos.z local velo = player:GetPlayerVelocity() local dist = math.abs( cur_height - floor_height ) if not player:IsMidair() then player:SetAbsOrigin( Vector( cur_pos.x, cur_pos.y, cur_pos.z + ( player.JetpackHeight / 4 ) ) ) end if player.JetpackBuster and (IsValid( Trace.Entity ) ) and ( Trace.Entity:GetClassname() == "obj_sentrygun" ) then player.Jetpack = false player.m_iHealth = 1 end -- print( Trace.Entity:IsRealPlayer() ) if player.JetpackKamikaze and (IsValid( Trace.Entity ) ) and ( Trace.Entity:IsRealPlayer() ) then player.Jetpack = false end player:SetPlayerVelocity( Vector(velo.x,velo.y,0) ) if player:IsBot() then player:SetForwardVelocity( 200 * player:GetAttributeValueByClass("mod_air_control", 1 ) ) end if cur_height > ( target_height + 16 ) then player:SetPlayerVelocity( Vector(velo.x,velo.y,-100) ) elseif ( cur_height + 16 ) < target_height then player:SetPlayerVelocity( Vector(velo.x,velo.y,100) ) end if player.m_StuckLast > 0 then player:SetAbsOrigin(player.SpawnPos) end end end end function OnWaveSpawnBot(bot, wave, tags) bot.Jetpack = false bot.JetpackBuster = false bot.JetpackKamikaze = false bot.JetpackHeight = 0 GiveCallbacks( bot, tags ) end function ToggleJetpack(height, activator) if activator.Jetpack then activator.Jetpack = false else activator.Jetpack = true activator.SpawnPos = activator:GetAbsOrigin() end activator.JetpackHeight = height activator.DeathCallback = activator:AddCallback( ON_DEATH, function() activator.Jetpack = false activator:RemoveCallback( ON_DEATH, activator.DeathCallback ) end) end function ToggleJetpackBuster(height, activator) if activator.Jetpack then activator.Jetpack = false activator.JetpackBuster = false else activator.Jetpack = true activator.JetpackBuster = true activator.SpawnPos = activator:GetAbsOrigin() end activator.JetpackHeight = height activator.DeathCallback = activator:AddCallback( ON_DEATH, function() activator.Jetpack = false activator.JetpackBuster = false activator:RemoveCallback( ON_DEATH, activator.DeathCallback ) end) end function ToggleJetpackKamikaze(height, activator) if activator.Jetpack then activator.Jetpack = false activator.JetpackKamikaze = false else activator.Jetpack = true activator.JetpackKamikaze = true activator.SpawnPos = activator:GetAbsOrigin() end activator.JetpackHeight = height activator.DeathCallback = activator:AddCallback( ON_DEATH, function() activator.Jetpack = false activator.JetpackKamikaze = false activator:RemoveCallback( ON_DEATH, activator.DeathCallback ) end) end