Skip to content

Instantly share code, notes, and snippets.

@Lunaversitay
Last active August 30, 2017 00:22
Show Gist options
  • Save Lunaversitay/013d7de1c5d6d984389cc5842513c6db to your computer and use it in GitHub Desktop.
Save Lunaversitay/013d7de1c5d6d984389cc5842513c6db to your computer and use it in GitHub Desktop.
TTT "decoy"
-- being sold for $2.5 on gms lol
-- weapon code
AddCSLuaFile()
if CLIENT then
SWEP.PrintName = "Decoy Grenade (weapon)"
SWEP.Slot = 3
SWEP.Icon = "vgui/ttt/icon_nades"
SWEP.IconLetter = "O"
end
SWEP.Base = "weapon_tttbasegrenade"
SWEP.HoldType = "grenade"
SWEP.UseHands = true
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV = 54
SWEP.ViewModel = Model( "models/weapons/cstrike/c_eq_fraggrenade.mdl" )
SWEP.WorldModel = Model( "models/weapons/w_eq_fraggrenade.mdl" )
SWEP.Kind = WEAPON_NADE
SWEP.AutoSpawnable = false
SWEP.CanBuy = { ROLE_TRAITOR } -- make it a T weapon
SWEP.InLoadoutFor = { nil }
SWEP.LimitedStock = true
SWEP.AllowDrop = true
SWEP.NoSights = true
function SWEP:GetGrenadeName()
return "ttt_frag_proj"
end
if CLIENT then
SWEP.EquipMenuData = {
type = "Decoy",
desc = "Being sold for $2 on gms with a couple edits!"
}
end
-- proj code
AddCSLuaFile()
ENT.Type = "anim"
ENT.Base = "ttt_basegrenade_proj"
ENT.Model = Model( "models/weapons/w_eq_fraggrenade_thrown.mdl" )
AccessorFunc( ENT, "radius", "Radius", FORCE_NUMBER )
AccessorFunc( ENT, "dmg", "Dmg", FORCE_NUMBER )
function ENT:Initialize()
if not self:GetRadius() then self:SetRadius( 0 ) end
if not self:GetDmg() then self:SetDmg( 0 ) end
return self.BaseClass.Initialize( self )
end
function ENT:Explode( tr )
if SERVER then
self:SetNoDraw( true )
self:SetSolid( SOLID_NONE )
if tr.Fraction != 1.0 then
self:SetPos( tr.HitPos + tr.HitNormal * 0.6 )
end
local pos = self:GetPos()
if util.PointContents( pos ) == CONTENTS_WATER then
self:Remove()
return
end
local effect = EffectData()
effect:SetStart( pos )
effect:SetOrigin( pos )
effect:SetScale( self:GetRadius() * 0.3 )
effect:SetRadius( self:GetRadius() )
effect:SetMagnitude( self.dmg )
if tr.Fraction != 1.0 then
effect:SetNormal( tr.HitNormal )
end
util.Effect( "Explosion", effect, true, true )
util.BlastDamage( self, self:GetThrower(), pos, self:GetRadius(), self:GetDmg() )
self:SetDetonateExact( 0 )
self:Remove()
else
local spos = self:GetPos()
local trs = util.TraceLine( { start=spos + Vector( 0, 0, 64 ), endpos = spos + Vector( 0, 0, -128 ), filter = self } )
util.Decal( "Scorch", trs.HitPos + trs.HitNormal, trs.HitPos - trs.HitNormal )
self:SetDetonateExact( 0 )
end
end
@issaassii
Copy link

wtf kys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment