diff options
Diffstat (limited to 'entities/weapons/rad_grenade/shared.lua')
| -rw-r--r-- | entities/weapons/rad_grenade/shared.lua | 89 |
1 files changed, 44 insertions, 45 deletions
diff --git a/entities/weapons/rad_grenade/shared.lua b/entities/weapons/rad_grenade/shared.lua index 516f491..fe05c4a 100644 --- a/entities/weapons/rad_grenade/shared.lua +++ b/entities/weapons/rad_grenade/shared.lua @@ -1,18 +1,18 @@ if SERVER then AddCSLuaFile("shared.lua") - + end if CLIENT then SWEP.ViewModelFlip = true - + SWEP.PrintName = "HE Grenade" SWEP.IconLetter = "h" SWEP.Slot = 3 SWEP.Slotpos = 3 - + end SWEP.HoldType = "grenade" @@ -39,70 +39,70 @@ SWEP.Primary.Delay = 2.300 SWEP.Primary.ClipSize = 1 SWEP.Primary.Automatic = false -function SWEP:Think() +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 - + + 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_fraggrenade_thrown.mdl" ) - - if self.Owner:HasItem( tbl.ID ) then - + + if self.Owner:HasItem( tbl.ID ) then + self.Owner:RemoveFromInventory( tbl.ID ) - + end - + local ent = ents.Create( "sent_grenade" ) 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_grenade" ) - + end - + end - + end - + if self.ReloadTime and self.ReloadTime < CurTime() then - + self.ReloadTime = nil - + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) - + end end @@ -113,7 +113,7 @@ function SWEP:SecondaryAttack() 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 @@ -126,26 +126,25 @@ function SWEP:PrimaryAttack() 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() +function SWEP:ShootEffects() if IsFirstTimePredicted() then - - self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) - + + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) + end - - self.Owner:SetAnimation( PLAYER_ATTACK1 ) - + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + end function SWEP:DrawHUD() end - |
