zombiesurvival-evolved/gamemodes/zombiesurvival/entities/weapons/weapon_zs_bulletstorm.lua

84 lines
2.2 KiB
Lua
Raw Normal View History

2014-10-02 08:49:54 +08:00
AddCSLuaFile()
DEFINE_BASECLASS("weapon_zs_base")
2014-10-02 08:49:54 +08:00
SWEP.PrintName = "'Bullet Storm' SMG"
SWEP.Description = "Hold right click to use the Storm firing mode: fire rate is reduced to 60% but two bullets are fired at once."
SWEP.Slot = 2
SWEP.SlotPos = 0
2014-10-02 08:49:54 +08:00
if CLIENT then
2014-10-02 08:49:54 +08:00
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV = 50
SWEP.HUD3DBone = "v_weapon.p90_Release"
SWEP.HUD3DPos = Vector(-1.35, -0.5, -6.5)
SWEP.HUD3DAng = Angle(0, 0, 0)
end
SWEP.Base = "weapon_zs_base"
SWEP.HoldType = "smg"
SWEP.ViewModel = "models/weapons/cstrike/c_smg_p90.mdl"
SWEP.WorldModel = "models/weapons/w_smg_p90.mdl"
SWEP.UseHands = true
SWEP.Primary.Sound = Sound("Weapon_p90.Single")
SWEP.Primary.Damage = 17.5
2014-10-02 08:49:54 +08:00
SWEP.Primary.NumShots = 1
SWEP.Primary.Delay = 0.07
SWEP.Primary.ClipSize = 50
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "smg1"
GAMEMODE:SetupDefaultClip(SWEP.Primary)
SWEP.ConeMax = 5.5
SWEP.ConeMin = 3
2014-10-02 08:49:54 +08:00
SWEP.Primary.Gesture = ACT_HL2MP_GESTURE_RANGE_ATTACK_SMG1
SWEP.ReloadGesture = ACT_HL2MP_GESTURE_RELOAD_SMG1
SWEP.WalkSpeed = SPEED_SLOW
SWEP.Tier = 4
SWEP.MaxStock = 3
2014-10-02 08:49:54 +08:00
SWEP.IronSightsPos = Vector(-2, 6, 3)
SWEP.IronSightsAng = Vector(0, 2, 0)
GAMEMODE:AttachWeaponModifier(SWEP, WEAPON_MODIFIER_RELOAD_SPEED, 0.1)
function SWEP:PrimaryAttack()
if not self:CanPrimaryAttack() then return end
local ironsights = self:GetIronsights()
self:SetNextPrimaryFire(CurTime() + self:GetFireDelay() * (ironsights and 1.3333 or 1))
self:EmitFireSound()
self:TakeAmmo()
self:ShootBullets(self.Primary.Damage * (ironsights and 0.6666 or 1), self.Primary.NumShots * (ironsights and 2 or 1), self:GetCone())
self.IdleAnimation = CurTime() + self:SequenceDuration()
end
2014-10-02 08:49:54 +08:00
function SWEP:SetIronsights(b)
if self:GetIronsights() ~= b then
if b then
self:EmitSound("npc/scanner/scanner_scan4.wav", 40)
else
self:EmitSound("npc/scanner/scanner_scan2.wav", 40)
end
end
BaseClass.SetIronsights(self, b)
2014-10-02 08:49:54 +08:00
end
function SWEP:SecondaryAttack()
if self:GetNextSecondaryFire() <= CurTime() and not self:GetOwner():IsHolding() and self:GetReloadFinish() == 0 then
self:SetIronsights(true)
2014-10-02 08:49:54 +08:00
end
end
util.PrecacheSound("npc/scanner/scanner_scan4.wav")
util.PrecacheSound("npc/scanner/scanner_scan2.wav")