Skip to content

Commit

Permalink
cvars to enable hit decals and effects
Browse files Browse the repository at this point in the history
  • Loading branch information
xDShot committed Sep 26, 2016
1 parent 109410a commit 645db9b
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lua/weapons/csgo_baseknife.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ if ( SERVER ) then
CreateConVar("csgo_knives_secondary", 1, FCVAR_ARCHIVE, "Allow secondary attacks")
CreateConVar("csgo_knives_inspecting", 1, FCVAR_ARCHIVE, "Allow inspecting")
CreateConVar("csgo_knives_force_ttt", 0, FCVAR_ARCHIVE, "Forces knives to enable TTT mode. For debug purposes. Normally you shouldn't enable it unless you haven't any trouble getting it work in ttt")
CreateConVar("csgo_knives_decals", 1, FCVAR_ARCHIVE, "Paint wall decals when hit wall" )
CreateConVar("csgo_knives_hiteffect", 1, FCVAR_ARCHIVE, "Draw effect when hit wall" )

CreateConVar("csgo_knives_dmg_sec_back", 180, FCVAR_ARCHIVE, "How much damage deal when hit with secondary attack from behind")
CreateConVar("csgo_knives_dmg_sec_front", 65, FCVAR_ARCHIVE, "How much damage deal when hit with secondary attack in front or from side")
Expand Down Expand Up @@ -286,19 +288,20 @@ function SWEP:DoAttack( Altfire )

if tr.HitWorld then --and ( game.SinglePlayer() or CLIENT )

util.Decal( "ManhackCut", AttackSrc - Forward, AttackEnd + Forward )

local effectdata = EffectData()
effectdata:SetOrigin( tr.HitPos + tr.HitNormal )
effectdata:SetStart( tr.StartPos )
effectdata:SetSurfaceProp( tr.SurfaceProps )
effectdata:SetDamageType( DMG_SLASH )
effectdata:SetHitBox( tr.HitBox )
effectdata:SetNormal( tr.HitNormal )
effectdata:SetEntity( tr.Entity )
effectdata:SetAngles( Forward:Angle() )
util.Effect( "csgo_knifeimpact", effectdata )

if cvars.Bool("csgo_knives_decals", true) then util.Decal( "ManhackCut", AttackSrc - Forward, AttackEnd + Forward, true ) end

if cvars.Bool("csgo_knives_hiteffect", true) then
local effectdata = EffectData()
effectdata:SetOrigin( tr.HitPos + tr.HitNormal )
effectdata:SetStart( tr.StartPos )
effectdata:SetSurfaceProp( tr.SurfaceProps )
effectdata:SetDamageType( DMG_SLASH )
effectdata:SetHitBox( tr.HitBox )
effectdata:SetNormal( tr.HitNormal )
effectdata:SetEntity( tr.Entity )
effectdata:SetAngles( Forward:Angle() )
util.Effect( "csgo_knifeimpact", effectdata )
end
end

-- Change next attack time
Expand Down

0 comments on commit 645db9b

Please sign in to comment.