summaryrefslogtreecommitdiff
path: root/entities/weapons/rad_incendiarygrenade/shared.lua
diff options
context:
space:
mode:
Diffstat (limited to 'entities/weapons/rad_incendiarygrenade/shared.lua')
-rw-r--r--entities/weapons/rad_incendiarygrenade/shared.lua151
1 files changed, 151 insertions, 0 deletions
diff --git a/entities/weapons/rad_incendiarygrenade/shared.lua b/entities/weapons/rad_incendiarygrenade/shared.lua
new file mode 100644
index 0000000..3dda5dc
--- /dev/null
+++ b/entities/weapons/rad_incendiarygrenade/shared.lua
@@ -0,0 +1,151 @@
+if SERVER then
+
+ AddCSLuaFile("shared.lua")
+
+end
+
+if CLIENT then
+
+ SWEP.ViewModelFlip = true
+
+ SWEP.PrintName = "Incendiary Grenade"
+ SWEP.IconLetter = "h"
+ SWEP.Slot = 3
+ SWEP.Slotpos = 3
+
+end
+
+SWEP.HoldType = "grenade"
+
+SWEP.Base = "rad_base"
+
+SWEP.ViewModel = "models/weapons/v_eq_flashbang.mdl"
+SWEP.WorldModel = "models/weapons/w_eq_flashbang.mdl"
+
+SWEP.SprintPos = Vector (10.9603, -1.1484, -0.4996)
+SWEP.SprintAng = Vector (13.9974, 21.7915, 59.3288)
+
+SWEP.IsSniper = false
+SWEP.AmmoType = "Knife"
+SWEP.ThrowPower = 300
+
+SWEP.Primary.Sound = Sound( "WeaponFrag.Throw" )
+SWEP.Primary.Recoil = 6.5
+SWEP.Primary.Damage = 1
+SWEP.Primary.NumShots = 1
+SWEP.Primary.Cone = 0.100
+SWEP.Primary.Delay = 2.300
+
+SWEP.Primary.ClipSize = 1
+SWEP.Primary.Automatic = false
+
+function SWEP:Think()
+
+ if self.Owner:GetVelocity():Length() > 0 then
+
+ if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() > 0 and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then
+
+ self.LastRunFrame = CurTime() + 0.3
+
+ end
+
+ end
+
+ if self.ThrowTime then
+
+ if self.ThrowTime - 0.3 < CurTime() and not self.ThrowAnim then
+
+ self.ThrowAnim = true
+
+ if self.ThrowPower > 1000 then
+
+ self.Weapon:SendWeaponAnim( ACT_VM_THROW )
+
+ end
+
+ end
+
+ if self.ThrowTime < CurTime() then
+
+ self.ThrowTime = nil
+ self.ReloadTime = CurTime() + 0.75
+
+ if CLIENT then return end
+
+ local tbl = item.GetByModel( "models/weapons/w_eq_flashbang.mdl" )
+
+ if self.Owner:HasItem( tbl.ID ) then
+
+ self.Owner:RemoveFromInventory( tbl.ID )
+
+ end
+
+ local ent = ents.Create( "sent_grenade_incendiary" )
+ ent:SetPos( self.Owner:GetShootPos() + self.Owner:GetRight() * 5 + self.Owner:GetUp() * -5 )
+ ent:SetOwner( self.Owner )
+ ent:SetAngles( self.Owner:GetAimVector():Angle() )
+ ent:SetSpeed( self.ThrowPower )
+ ent:Spawn()
+
+ if not self.Owner:HasItem( tbl.ID ) then
+
+ self.Owner:StripWeapon( "rad_incendiarygrenade" )
+
+ end
+
+ end
+
+ end
+
+ if self.ReloadTime and self.ReloadTime < CurTime() then
+
+ self.ReloadTime = nil
+
+ self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
+
+ end
+
+end
+
+function SWEP:SecondaryAttack()
+
+ self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW )
+ self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
+ self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
+ self.Weapon:ShootEffects()
+
+ self.ThrowTime = CurTime() + 1.25
+ self.ThrowAnim = false
+ self.ThrowPower = 800
+
+end
+
+function SWEP:PrimaryAttack()
+
+ self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW )
+ self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
+ self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
+ self.Weapon:ShootEffects()
+
+ self.ThrowTime = CurTime() + 1.25
+ self.ThrowAnim = false
+ self.ThrowPower = 3000
+
+end
+
+function SWEP:ShootEffects()
+
+ if SERVER then
+
+ self.Owner:ViewBounce( self.Primary.Recoil )
+
+ end
+
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+end
+
+function SWEP:DrawHUD()
+
+end
+