diff --git a/lua/weapons/koolaids_poo_blaster.lua b/lua/weapons/koolaids_poo_blaster.lua index 96e8c54..2706169 100644 --- a/lua/weapons/koolaids_poo_blaster.lua +++ b/lua/weapons/koolaids_poo_blaster.lua @@ -67,12 +67,7 @@ function SWEP:SecondaryAttack() self:EmitSound( self.Secondary.Sound ) self:ThrowChair( "models/weapons/w_bugbait.mdl" ) end - --- A custom function we added. When you call this the player will fire a chair! -function SWEP:ThrowChair( model_file ) - local owner = self:GetOwner() - - -- Make sure the weapon is being held before trying to throw a chair +function SWEP:blast(mdl,bool) if ( not owner:IsValid() ) then return end -- Play the shoot sound we precached earlier! @@ -88,7 +83,7 @@ function SWEP:ThrowChair( model_file ) if ( not ent:IsValid() ) then return end -- Set the entity's model to the passed in model - ent:SetModel( model_file ) + ent:SetModel( mdl ) ent:SetMass(40) -- This is the same as owner:EyePos() + (self:GetOwner():GetAimVector() * 16) -- but the vector methods prevent duplicitous objects from being created @@ -116,7 +111,11 @@ function SWEP:ThrowChair( model_file ) -- to adjust how fast we throw it. -- Now that this is the last use of the aimvector vector we created, -- we can directly modify it instead of creating another copy - aimvec:Mul( 1000 ) -- Add a random vector with elements [-10, 10) + if bool then + aimvec:Mul( -1000 ) -- Add a random vector with elements [-10, 10) + else + aimvec:Mul( 1000 ) + end phys:ApplyForceCenter( aimvec ) -- Assuming we're playing in Sandbox mode we want to add this -- entity to the cleanup and undo lists. This is done like so. @@ -132,4 +131,15 @@ function SWEP:ThrowChair( model_file ) -- To fix this we add a 10 second delay to remove the chair after it was spawned. -- ent:IsValid() checks if the item still exists before removing it, eliminating errors. timer.Simple( 3, function() if ent and ent:IsValid() then ent:Remove() end end ) +end +-- A custom function we added. When you call this the player will fire a chair! +function SWEP:ThrowChair( model_file ) + local owner = self:GetOwner() + if model_file == "models/weapons/w_bugbait.mdl" then + for i=1,10 do + self:blast("models/weapons/w_bugbait.mdl",true) + end + else + self:blast(model_file,false) + end end \ No newline at end of file