Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- PopCorn XD)
- SWEP.ViewModel = "models/Teh_Maestro/popcorn.mdl"
- SWEP.WorldModel = "models/Teh_Maestro/popcorn.mdl"
- SWEP.Spawnable = true
- SWEP.AdminSpawnable = false
- SWEP.Primary.Clipsize = -1
- SWEP.Primary.DefaultClip = -1
- SWEP.Primary.Automatic = false
- SWEP.Primary.Ammo = "none"
- SWEP.Secondary.Clipsize = -1
- SWEP.Secondary.DefaultClip = -1
- SWEP.Secondary.Automatic = false
- SWEP.Secondary.Ammo = "none"
- SWEP.Slot = 1
- SWEP.SlotPos = 1
- SWEP.HoldType = "shotgun"
- function SWEP:Think()
- end
- function SWEP:Initialize()
- util.PrecacheSound("crisps/eat.wav")
- end
- function SWEP:PrimaryAttack()
- self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
- self.Owner:EmitSound("crisps/eat.wav")
- local tr = {}
- tr.start = self.Owner:GetShootPos()
- tr.endpos = self.Owner:GetShootPos() + ( self.Owner:GetAimVector() * 50 )
- tr.filter = self.Owner
- tr.mask = MASK_SHOT
- local trace = util.TraceLine( tr )
- self.Weapon:SetNextPrimaryFire(CurTime() + 6.5)
- if ( trace.Hit ) then
- if trace.Entity:IsPlayer() or string.find(trace.Entity:GetClass(),"npc") or string.find(trace.Entity:GetClass(),"prop_ragdoll") then
- bullet = {}
- bullet.Num = 1
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector(0, 0, 0)
- bullet.Tracer = 0
- bullet.Force = 1
- bullet.Damage = 0
- else
- bullet = {}
- bullet.Num = 1
- bullet.Src = self.Owner:GetShootPos()
- bullet.Dir = self.Owner:GetAimVector()
- bullet.Spread = Vector(0, 0, 0)
- bullet.Tracer = 0
- bullet.Force = 1
- bullet.Damage = 0
- end
- end
- end
- function SWEP:SecondaryAttack()
- local match, heat, att, phys, tr, particle
- self.Owner:AnimRestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_GMOD_GESTURE_ITEM_PLACE )
- self.Weapon:SetNextSecondaryFire(CurTime() + 16)
- if CLIENT then
- return
- end
- self.Owner:EmitSound( "weapons/slam/throw.wav" )
- self.Hand = self.Hand or self.Owner:LookupAttachment( "anim_attachment_lh" )
- match = ents.Create( "prop_physics" )
- match:SetModel( "models/Teh_Maestro/popcorn.mdl" )
- match:SetOwner( self.Owner )
- match:SetSolid( SOLID_NONE )
- if self.Hand == -1 then
- att = self.Owner:GetAttachment( self.Hand )
- match:SetPos( att.Pos )
- else
- match:SetPos( self.Owner:GetShootPos( ) )
- end
- match:Spawn( )
- heat = ents.Create( "env_firesource" )
- heat:SetPos( match:GetPos( ) )
- heat:SetParent( match )
- heat:Spawn( )
- heat:Input( "Enable" )
- phys = match:GetPhysicsObject( )
- tr = util.TraceLine{
- start = self.Owner:GetShootPos( ),
- endpos = self.Owner:GetShootPos( ) + self.Owner:GetAimVector( ) * 512,
- filter = { match, heat, self.Owner, particle },
- }
- self.Owner:StripWeapon("weapon_popcorn")
- SafeRemoveEntityDelayed( match, 6 )
- particle = ents.Create( "info_particle_system" )
- particle:SetKeyValue( "start_active", 1 )
- particle:SetKeyValue( "effect_name", "fire_verysmall_01" )
- particle:Spawn( )
- particle:SetPos( match:GetPos( ) )
- particle:SetParent( match )
- particle:Activate( )
- if IsValid( phys ) then
- phys:SetVelocity( ( tr.HitPos - match:GetPos( ) ):GetNormal( ) * 128 * phys:GetMass( ) )
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement