So i wanted my CS:S weapons to eject shells. I made an effect for it.
The effect covers every bullet type in CS:S and also has appropriate sounds for each.
Here's how you'd use it:
SHELL_9MM = 1
SHELL_57 = 2
SHELL_556 = 3
SHELL_762NATO = 4
SHELL_SHOTGUN = 5
SHELL_338MAG = 6
-- this would be done in the base swep
SWEP.Primary.ShellType = SHELL_9MM
-- this would go in each SWEP
local ed = EffectData()
ed:SetEntity( self.Weapon )
ed:SetAttachment( self.Weapon:LookupAttachment( "2" ) )
ed:SetScale( self.Primary.ShellType )
util.Effect( "weapon_shell", ed, true, true )
-- this would go under the primary fire function somewhere
Problems i'm having:
[list][*]The shells don't have physics objects (not a huge issue, i just use a 2x2x2 box for their model)[*]Some weapons (so far only the TMP model) have an awkward shell eject position. It doesn't look horrible though.[*]The shells make a plastic impact sound when they hit the floor. There is no physics object material that doesn't make sounds. So i guess garry needs to add a "gmod_nosound" physics material to fix this problem.[/list]
I'll post a download link if you guys are interested in having this now.