Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lua/weapons/bobs_gun_base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ end

function SWEP:PrimaryAttack()
if not self:CanPrimaryAttack() then return end
if self:CheckWater() then return end

local owner = entity_GetOwner(self)

Expand Down Expand Up @@ -444,6 +445,16 @@ function SWEP:CheckWeaponsAndAmmo()
end
end

function SWEP:CheckWater()
if entity_GetOwner(self):WaterLevel() == 3 and not self.FiresUnderwater then
self:SetNextPrimaryFire( CurTime() + 0.2 )
self:EmitSound( "Weapon_Pistol.Empty" )
return true
end

return false
end

--[[---------------------------------------------------------
Name: SWEP:ShootBulletInformation()
Desc: This func add the damage, the recoil, the number of shots and the cone on the bullet.
Expand Down
2 changes: 2 additions & 0 deletions lua/weapons/m9k_an94.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ end
SWEP.Primary.PrevShots = SWEP.Primary.NumShots

function SWEP:PrimaryAttack()
if self:CheckWater() then return end

local owner = self:GetOwner()

if self:CanPrimaryAttack() and owner:IsPlayer() then
Expand Down
1 change: 1 addition & 0 deletions lua/weapons/m9k_contender.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function SWEP:PrimaryAttack()
local owner = self:GetOwner()

if owner:IsNPC() then return end
if self:CheckWater() then return end
if not self:CanPrimaryAttack() then return end
if owner:KeyDown( IN_SPEED ) then return end

Expand Down
4 changes: 3 additions & 1 deletion lua/weapons/m9k_dbarrel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ cvars.AddChangeCallback( "M9KDamageMultiplier", dmgMultCallback, "dbarrel" )

function SWEP:SecondaryAttack()
if not self:CanPrimaryAttack() then return end

if self:CheckWater() then return end

local owner = self:GetOwner()

local timerName = "ShotgunReload_" .. owner:UniqueID()
Expand Down Expand Up @@ -107,6 +108,7 @@ end

function SWEP:PrimaryAttack()
if not self:CanPrimaryAttack() then return end
if self:CheckWater() then return end

local owner = self:GetOwner()

Expand Down