Skip to content

Instantly share code, notes, and snippets.

@BadgerCode
Last active March 31, 2019 13:59
Show Gist options
  • Save BadgerCode/073620af27d94485632a5373101a0d98 to your computer and use it in GitHub Desktop.
Save BadgerCode/073620af27d94485632a5373101a0d98 to your computer and use it in GitHub Desktop.
TTT jump canon modified (to behave mostly the same way it did on questionable ethics TTT)
-- Original addon
-- https://steamcommunity.com/sharedfiles/filedetails/?id=267785752
AddCSLuaFile("shared.lua")
SWEP.Author = "Delta7x"
SWEP.Instructions = "Shoot in the opposite direction of where you would like to be propelled."
SWEP.HoldType = "physgun"
if CLIENT then
SWEP.PrintName = "Jump Gun"
SWEP.Slot = 8
SWEP.Icon = "vgui/ttt/icon_launch"
SWEP.ViewModelFOV = 72
SWEP.EquipMenuData = {
type = "item_weapon",
desc = "Shoot to go the opposite direction (ie; Shoot down to go up)."
};
end
SWEP.Base = "weapon_tttbase"
SWEP.Kind = WEAPON_EQUIP
SWEP.WeaponID = AMMO_STUN
SWEP.CanBuy = {ROLE_DETECTIVE, ROLE_TRAITOR}
SWEP.LimitedStock = true
SWEP.Primary.Damage = 0.25
SWEP.Primary.Delay = 0.05
SWEP.Primary.Cone = 0
SWEP.Primary.Automatic = true
SWEP.Primary.Recoil = 0
SWEP.Primary.Knockback = 100
SWEP.Primary.ClipSize = 100
SWEP.Primary.ClipMax = 100
SWEP.Primary.DefaultClip = 100
SWEP.Primary.InfiniteClip = false
SWEP.Primary.Ammo = nil
SWEP.AutoSpawnable = false
SWEP.UseHands = true
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV = 54
SWEP.ViewModel = "models/weapons/c_superphyscannon.mdl"
SWEP.WorldModel = "models/weapons/w_physics.mdl"
SWEP.NoSights = true
--SWEP.DeploySpeed = 3
function SWEP:PrimaryAttack(worldsnd)
if self.Primary.InfiniteClip == false and not self:CanPrimaryAttack() then return end
self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Owner:SetVelocity(self.Owner:GetForward() * -(self.Primary.Knockback) )
self:ShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self:GetPrimaryCone() )
self:TakePrimaryAmmo( 1 )
local owner = self.Owner
if not IsValid(owner) or owner:IsNPC() or (not owner.ViewPunch) then return end
owner:ViewPunch( Angle( math.Rand(-0.2,-0.1) * self.Primary.Recoil, math.Rand(-0.1,0.1) *self.Primary.Recoil, 0 ) )
local bullet = {
Attacker = self.Owner,
Num = 1,
Src = self.Owner:GetShootPos(),
Dir = self.Owner:GetAimVector(),
Spread = 0.1 * 0.1 , 0.1 * 0.1, 0,
Tracer = 1,
TracerName = "AirboatGunHeavyTracer",
Force = self.Primary.NumShots,
Damage = self.Primary.Damage
}
bullet.Callback = function(attacker, trace, dmginfo)
dmginfo:SetDamageType(DMG_AIRBOAT)
end
self.Weapon:FireBullets(bullet)
end
function SWEP:Reload()
if (self:Clip1() == self.Primary.ClipSize) then
return
end
self:SetIronsights(false)
self:SetClip1(self.Primary.ClipSize)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment